tqt history tab txn drag and drop: fix #5635 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1f305bba3994cbdcaed1c47cca201396690fe1e6 DIR parent 1ecbafb920a7fb87dd3c7d38c8e5ed3560d52183 HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 13 Sep 2019 14:12:40 +0200 qt history tab txn drag and drop: fix #5635 Diffstat: M electrum/gui/qt/history_list.py | 5 ++++- M electrum/gui/qt/main_window.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py t@@ -655,9 +655,12 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): try: with open(fn) as f: tx = self.parent.tx_from_text(f.read()) - self.parent.save_transaction_into_wallet(tx) except IOError as e: self.parent.show_error(e) + return + if not tx: + return + self.parent.save_transaction_into_wallet(tx) def export_history_dialog(self): d = WindowModalDialog(self, _('Export History')) DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py t@@ -2652,7 +2652,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): d = PasswordDialog(parent, msg) return d.run() - def tx_from_text(self, txt): + def tx_from_text(self, txt) -> Optional[Transaction]: from electrum.transaction import tx_from_str try: tx = tx_from_str(txt) t@@ -2685,7 +2685,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): return self.show_transaction(tx) - def read_tx_from_file(self): + def read_tx_from_file(self) -> Optional[Transaction]: fileName = self.getOpenFileName(_("Select your transaction file"), "*.txn") if not fileName: return