changeset 358:8efed1d47d9f

core: don't crash when a widget without profiles switch to default widget
author Goffi <goffi@goffi.org>
date Sat, 18 Jan 2020 23:12:52 +0100
parents 4d3a0c4f2430
children 38d763febed6
files cagou/core/cagou_main.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/cagou_main.py	Sat Jan 18 23:12:52 2020 +0100
+++ b/cagou/core/cagou_main.py	Sat Jan 18 23:12:52 2020 +0100
@@ -750,7 +750,11 @@
             old = self.getWidgetToSwitch()
         if new is None:
             factory = self.default_wid['factory']
-            new = factory(self.default_wid, None, profiles=old.profiles)
+            try:
+                profiles = old.profiles
+            except AttributeError:
+                profiles = None
+            new = factory(self.default_wid, None, profiles=profiles)
         to_change = None
         if isinstance(old, CagouWidget):
             to_change = old