1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

common/tools: validate for string emptiness in cointool

This commit is contained in:
Pavol Rusnak 2020-06-10 14:26:04 +00:00 committed by Tomas Susanka
parent f8b2f0bb7b
commit 46087c4a2b

View File

@ -76,6 +76,8 @@ def check_type(val, types, nullable=False, empty=False, regex=None, choice=None)
# check empty
if isinstance(val, (list, dict)) and not empty and not val:
raise ValueError("Empty collection")
if isinstance(val, str) and not empty and not val:
raise ValueError("Empty string")
# check regex
if regex is not None: