Skip to content

Commit 6fea4b5

Browse files
committed
Revert "Changed to check if ConVar is a valid ConVar."
This reverts commit 94e24ba.
1 parent 94e24ba commit 6fea4b5

File tree

1 file changed

+7
-8
lines changed
  • addons/source-python/packages/source-python/cvars

1 file changed

+7
-8
lines changed

addons/source-python/packages/source-python/cvars/__init__.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,15 @@ def __init__(self, *convars):
4848

4949
_convars = []
5050
for convar in convars:
51-
if isinstance(convar, str):
52-
convar_name = convar
53-
elif isinstance(convar, ConVar):
54-
convar_name = convar.name
55-
else:
51+
if not isinstance(convar, (str, ConVar)):
5652
raise ValueError('Given convar is not ConVar or ConVar name.')
5753

58-
convar = cvar.find_var(convar_name)
59-
if convar is None:
60-
raise ValueError(f'"{convar_name}" is not a valid ConVar.')
54+
elif isinstance(convar, str):
55+
convar_name = convar
56+
convar = cvar.find_var(convar_name)
57+
if convar is None:
58+
raise ValueError(
59+
f'"{convar_name}" is not a valid ConVar name.')
6160

6261
_convars.append(convar)
6362

0 commit comments

Comments
 (0)