Skip to content

Commit

Permalink
AttributeError in start_app(): 'NoneType' object has no attribute 'ge…
Browse files Browse the repository at this point in the history
…t_string' (#205)

* Fix: dock_applet.py crashed with AttributeError in adjust_minimise_pos(): NoneType object has no attribute get_value

* Fix get_string on NoneType

* fix crash in start_app(). Argument 0 of Gio.DesktopAppInfo.new_from_filename can't be None
  • Loading branch information
siddolo authored Aug 31, 2021
1 parent 01ddd88 commit a097520
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/docked_app.in
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,10 @@ class DockedApp(object):
Use Gio.DesktopAppinfo as it supports startup notfication
"""
# start the app
run_it = self.desktop_ai.get_string("Exec")
try:
run_it = self.desktop_ai.get_string("Exec")
except:
run_it = None

if run_it is not None:

Expand All @@ -1541,7 +1544,11 @@ class DockedApp(object):
self.run_cmd_line(run_it)
return

gdai = Gio.DesktopAppInfo.new_from_filename(self.desktop_file)
if self.desktop_file is not None:
gdai = Gio.DesktopAppInfo.new_from_filename(self.desktop_file)
else:
gdai = None

disp = Gdk.Display.get_default()
if build_gtk2:
alc = Gdk.AppLaunchContext()
Expand All @@ -1553,9 +1560,10 @@ class DockedApp(object):
alc.connect("launch-failed", self.launch_failed)

# indicate we want startup notification
self.startup_id = alc.get_startup_notify_id(gdai, [])
if gdai is not None:
self.startup_id = alc.get_startup_notify_id(gdai, [])

gdai.launch_uris_as_manager([], alc, GLib.SpawnFlags.SEARCH_PATH,
gdai.launch_uris_as_manager([], alc, GLib.SpawnFlags.SEARCH_PATH,
None, None, None, None)

# make the app's icon pulse
Expand Down

0 comments on commit a097520

Please sign in to comment.