summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2019-07-15 21:48:37 -0600
committerkotfu <kotfu@kotfu.net>2019-07-15 21:48:37 -0600
commit1b7330a58f37c481b17c8da9e7203dd3fe4c0461 (patch)
treeabbd9d24c1216efd6100999ac1c159b74106c39e
parent9bbebbd312dbe0331510f39cd6de70f4d9dcefa8 (diff)
downloadcmd2-git-1b7330a58f37c481b17c8da9e7203dd3fe4c0461.tar.gz
Fix feedback from PR
only try to call `onchange_hook` if it’s a callable.
-rw-r--r--cmd2/cmd2.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index a4036a8e..470f63ca 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -2962,7 +2962,7 @@ class Cmd(cmd.Cmd):
# See if we need to call a change hook for this settable
if orig_value != new_value:
onchange_hook = getattr(self, '_onchange_{}'.format(param), None)
- if onchange_hook is not None:
+ if onchange_hook is not None and callable(onchange_hook):
onchange_hook(old=orig_value, new=new_value) # pylint: disable=not-callable
shell_parser = ArgParser()