]> git.meshlink.io Git - catta/commitdiff
avahi-discover crashes if row is unselected
authorLennart Poettering <lennart@poettering.net>
Fri, 12 Dec 2008 19:25:23 +0000 (20:25 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 12 Dec 2008 19:25:23 +0000 (20:25 +0100)
Quoting james_w:

"I believe the cause of this was the a row was unselected,
meaning that get_selection() returned None for iter, which then
was used improperly in treemodel.get()

The attached patch should prevent this from happening. Please
consider applying it."

Patch from james_w.

Closes #226.

avahi-python/avahi-discover/avahi-discover.in

index 229c7bdb2a30fb7c26b4e809ff4d881f19215ee9..be8c08bc8b97171fdae991318a29bf67a7d07ee4 100755 (executable)
@@ -61,7 +61,9 @@ class Main_window(SimpleGladeApp):
 
     def on_tree_view_cursor_changed(self, widget, *args):
         (model, iter) = widget.get_selection().get_selected()
-        (name,interface,protocol,stype,domain) = self.treemodel.get(iter,1,2,3,4,5)
+        stype = None
+        if iter is not None:
+            (name,interface,protocol,stype,domain) = self.treemodel.get(iter,1,2,3,4,5)
         if stype == None:
             self.info_label.set_markup("<i>No service currently selected.</i>")
             return