From 32abe2dd041a6d4d59c7a149d5b53fc34e790ee4 Mon Sep 17 00:00:00 2001 From: vrde Date: Mon, 16 Sep 2013 21:26:55 +0200 Subject: [PATCH] Remove eval from from run_hook small improvement to remove eval using builtin function `getattr`. --- gui/gui_classic/main_window.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/gui_classic/main_window.py b/gui/gui_classic/main_window.py index 36085ba3d..7cddbbfc1 100644 --- a/gui/gui_classic/main_window.py +++ b/gui/gui_classic/main_window.py @@ -466,10 +466,11 @@ class ElectrumWindow(QMainWindow): for p in self.plugins: if not p.is_enabled(): continue - try: - f = eval('p.'+name) - except: - continue + + f = getattr(p, name, None) + if not callable(f): + return + try: apply(f, args) except: