[gnome-tweaks/wip/muktupavels/none-type] general: fix 'NoneType object has no attribute mode' error



commit b96fb3cbbdd6caf4136d271e028df5a75b93080f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Oct 16 21:28:57 2018 +0300

    general: fix 'NoneType object has no attribute mode' error
    
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/gtweak/app.py", line 30, in do_activate
        self.win = Window(self, model)
      File "/usr/lib/python3/dist-packages/gtweak/tweakview.py", line 38, in __init__
        self._model.load_tweaks(self)
      File "/usr/lib/python3/dist-packages/gtweak/tweakmodel.py", line 104, in load_tweaks
        mods = __import__("gtweak.tweaks", globals(), locals(), tweak_files, 0)
      File "/usr/lib/python3/dist-packages/gtweak/tweaks/tweak_group_general.py", line 14, in <module>
        _shell_not_ubuntu = _shell.mode != 'ubuntu'
    AttributeError: 'NoneType' object has no attribute 'mode'

 gtweak/tweaks/tweak_group_general.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtweak/tweaks/tweak_group_general.py b/gtweak/tweaks/tweak_group_general.py
index 2124691..11d0867 100644
--- a/gtweak/tweaks/tweak_group_general.py
+++ b/gtweak/tweaks/tweak_group_general.py
@@ -11,7 +11,10 @@ from gtweak.widgets import ListBoxTweakGroup, GetterSetterSwitchTweak, GSettings
 from gtweak.utils import AutostartFile
 
 _shell = GnomeShellFactory().get_shell()
-_shell_not_ubuntu = _shell.mode != 'ubuntu'
+_shell_not_ubuntu = True
+
+if _shell:
+  _shell_not_ubuntu = _shell.mode != 'ubuntu'
 
 class IgnoreLidSwitchTweak(GetterSetterSwitchTweak):
     def __init__(self, **options):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]