[gnome-tweak-tool] Fix crash on empty combo lists (bug 649003)



commit fabcef50d010feb093cebd59bef0de4bcb8d0da6
Author: John Stowers <john stowers gmail com>
Date:   Tue May 3 18:19:36 2011 +1200

    Fix crash on empty combo lists (bug 649003)

 gtweak/widgets.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index f50ae29..5434cfe 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -137,8 +137,11 @@ class GSettingsComboTweak(_GSettingsTweak):
     def __init__(self, schema_name, key_name, key_options, **options):
         _GSettingsTweak.__init__(self, schema_name, key_name, **options)
 
-        assert len(key_options) > 0
-        assert len(key_options[0]) == 2
+        #check key_options is iterable
+        #and if supplied, check it is a list of 2-tuples
+        assert len(key_options) >= 0
+        if len(key_options):
+            assert len(key_options[0]) == 2
 
         combo = build_combo_box_text(
                     self.settings.get_value(self.key_name),



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