NoneType isdigit Hotfix

* fix AttributeError if isdigit is called on a NoneType object
This commit is contained in:
nico 2018-11-11 04:00:16 +01:00
parent 56e7e6861f
commit a4ab459c05
No known key found for this signature in database
GPG key ID: EA7C31AAB1BDC1A2

View file

@ -32,6 +32,8 @@ def validate(keyword, target):
# check if keyword is in number_keyword list # check if keyword is in number_keyword list
elif keyword in StaticAnswers().keys('number_keywords'): elif keyword in StaticAnswers().keys('number_keywords'):
# prevent AttributeError if target is NoneType
if target is not None:
# if target only consists of digits return True # if target only consists of digits return True
return target.isdigit() return target.isdigit()