[Sugar-devel] [PATCH] Don't crash on invalid favoriteslayout settings

Bernie Innocenti bernie at codewiz.org
Tue May 4 19:22:36 EDT 2010


This could happen if the user upgrades Sugar to a new version which
doesn't support the old layout.

Signed-off-by: Bernie Innocenti <bernie at codewiz.org>
---
 src/jarabe/desktop/favoritesview.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 4a84f08..17898f2 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -697,6 +697,8 @@ class FavoritesSetting(object):
     def __init__(self):
         client = gconf.client_get_default() 
         self._layout = client.get_string(self._FAVORITES_KEY)
+        if not LAYOUT_MAP.has_key(self._layout):
+            self._layout = favoriteslayout.RingLayout.key
         logging.debug('FavoritesSetting layout %r' % (self._layout))
 
         self._mode = None
-- 
1.7.0.1



More information about the Sugar-devel mailing list