[alacarte] MainWindow: treeview.get_selection() in cursor-changed callbacks can return None



commit 244c6d0257114cdcb7349d52127c6ff2f0e4f2bc
Author: Alexandre Rostovtsev <tetromino gentoo org>
Date:   Thu May 24 00:54:20 2012 -0400

    MainWindow: treeview.get_selection() in cursor-changed callbacks can return None
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676702

 Alacarte/MainWindow.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/Alacarte/MainWindow.py b/Alacarte/MainWindow.py
index be460e1..fd18064 100644
--- a/Alacarte/MainWindow.py
+++ b/Alacarte/MainWindow.py
@@ -366,7 +366,10 @@ class MainWindow(object):
             GObject.timeout_add(100, self.waitForEditProcess, process, file_path)
 
     def on_menu_tree_cursor_changed(self, treeview):
-        menus, iter = treeview.get_selection().get_selected()
+        selection = treeview.get_selection()
+        if selection is None:
+            return
+        menus, iter = selection.get_selected()
         if iter is None:
             return
         menu_path = menus.get_path(iter)
@@ -424,7 +427,10 @@ class MainWindow(object):
         self.item_store[path][0] = not self.item_store[path][0]
 
     def on_item_tree_cursor_changed(self, treeview):
-        items, iter = treeview.get_selection().get_selected()
+        selection = treeview.get_selection()
+        if selection is None:
+            return
+        items, iter = selection.get_selected()
         if iter is None:
             return
         item = items[iter][3]



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