Skip to content

Commit

Permalink
GefSetting: Validate valid bool settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Grazfather committed Aug 26, 2023
1 parent 27ed67a commit e7a4b1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -9809,7 +9809,12 @@ def set_setting(self, argv: Tuple[str, Any]) -> None:
_type = gef.config.raw_entry(key).type
try:
if _type == bool:
_newval = True if new_value.upper() in ("TRUE", "T", "1") else False
if new_value.upper() in ("TRUE", "T", "1"):
_newval = True
elif new_value.upper() in ("FALSE", "F", "0"):
_newval = False
else:
raise ValueError(f"cannot parse '{new_value}' as bool")
else:
_newval = new_value
except Exception as e:
Expand Down

0 comments on commit e7a4b1f

Please sign in to comment.