From 6f844a86d2edbb2946d065ac850313bcf7868c35 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 11 Feb 2011 01:07:47 +0000 Subject: [PATCH] Fix Create Torrent Dialog Box - Some buttons raise Type Error if no row selected --- deluge/ui/gtkui/createtorrentdialog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 3535d9f93..f794b761b 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -377,6 +377,8 @@ class CreateTorrentDialog: def _on_button_up_clicked(self, widget): log.debug("_on_button_up_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return if self.trackers_liststore[row][0] == 0: return else: @@ -385,6 +387,8 @@ class CreateTorrentDialog: def _on_button_down_clicked(self, widget): log.debug("_on_button_down_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return self.trackers_liststore[row][0] += 1 def _on_button_add_clicked(self, widget): @@ -428,4 +432,6 @@ class CreateTorrentDialog: def _on_button_remove_clicked(self, widget): log.debug("_on_button_remove_clicked") row = self.glade.get_widget("tracker_treeview").get_selection().get_selected()[1] + if row is None: + return self.trackers_liststore.remove(row)