From d2447ef309115c491fa4a4372c9c0c446f986be3 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 9 Jun 2012 18:06:01 +0200 Subject: [PATCH] check item existence --- lib/gui_qt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gui_qt.py b/lib/gui_qt.py index 4153e4994..d4e0ae3a9 100644 --- a/lib/gui_qt.py +++ b/lib/gui_qt.py @@ -259,6 +259,7 @@ class ElectrumWindow(QMainWindow): def create_history_menu(self, position): self.history_list.selectedIndexes() item = self.history_list.currentItem() + if not item: return menu = QMenu() menu.addAction(_("Details"), lambda: self.tx_details(item,2)) menu.addAction(_("Edit description"), lambda: self.tx_label_clicked(item,2)) @@ -690,12 +691,13 @@ class ElectrumWindow(QMainWindow): # fixme: this function apparently has a side effect. # if it is not called the menu pops up several times self.contacts_list.selectedIndexes() + item = self.contacts_list.currentItem() + if not item: return addr = self.get_current_addr(False) menu = QMenu() menu.addAction(_("Pay to"), lambda: self.payto(addr)) menu.addAction(_("Copy to Clipboard"), lambda: self.app.clipboard().setText(addr)) menu.addAction(_("View QR code"),lambda: self.show_address_qrcode(addr)) - item = self.contacts_list.currentItem() label = unicode( item.text(1) ) if label not in self.wallet.aliases.keys(): menu.addAction(_("Edit label"), lambda: self.edit_label(False))