Skip to content

AttributeError: 'NoneType' object has no attribute 'get_id' #1236

@DarkRedman

Description

@DarkRedman

When the selection automatically change to another element when I just delete a task (after confirming) :

Context: Global generic exception

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/GTG/core/plugins/api.py", line 68, in __selection_changed
    func(selection)
    ~~~~^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/GTG/plugins/hamster/hamster.py", line 319, in selection_changed
    self.check_task_selected()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/GTG/plugins/hamster/hamster.py", line 329, in check_task_selected
    self.decide_button_mode(self.button, task)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/GTG/plugins/hamster/hamster.py", line 332, in decide_button_mode
    if self.is_task_active(task.get_id()):
                           ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_id'

Software versions:

  • Getting Things GNOME! 0.6.0
  • CPython 3.13.7 (main, Aug 15 2025, 12:34:02) [GCC 15.2.1 20250813]
  • GTK 3.24.50, GLib 2.84.4
  • PyGLib 3.52.3, PyGObject 3.52.3
  • Linux-6.12.44-3-MANJARO-x86_64-with-glibc2.42

So for now I naively rewrote the function as this for temporary fix by adding a None check :

    def decide_button_mode(self, button, task):
        if task is None:
            return
        
        if self.is_task_active(task.get_id()):
            self.change_button_to_stop_activity(button)
            self.change_task_menu_to_stop_activity(task.get_id())
        else:
            self.change_button_to_start_activity(button)
            self.change_task_menu_to_start_activity(task.get_id())

Metadata

Metadata

Assignees

No one assigned

    Labels

    pluginsPlugins and extra backends

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions