diff options
author | nico <nico@magicbroccoli.de> | 2018-11-11 04:00:16 +0100 |
---|---|---|
committer | nico <nico@magicbroccoli.de> | 2018-11-11 04:00:16 +0100 |
commit | a4ab459c054f56243b5b775bb773ebec578385f6 (patch) | |
tree | 4e8e81aa5754241c042ddcf055acb912dd87b3be | |
parent | 56e7e6861f2404b7f7ca37df09881380df8b177c (diff) |
NoneType isdigit Hotfix
* fix AttributeError if isdigit is called on a NoneType object
-rwxr-xr-x | common/misc.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/common/misc.py b/common/misc.py index 86798b8..b91c618 100755 --- a/common/misc.py +++ b/common/misc.py @@ -32,8 +32,10 @@ def validate(keyword, target): # check if keyword is in number_keyword list elif keyword in StaticAnswers().keys('number_keywords'): - # if target only consists of digits return True - return target.isdigit() + # prevent AttributeError if target is NoneType + if target is not None: + # if target only consists of digits return True + return target.isdigit() # if keyword is in no_arg_keywords list return True elif keyword in StaticAnswers().keys("no_arg_keywords"): |