Skip to content

Commit 080d8ca

Browse files
committed
Changed to raise an exception if ConCommand already exists when creating ConVar.
1 parent 6fea4b5 commit 080d8ca

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/core/modules/cvars/cvars.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ boost::shared_ptr<ConVar> ConVarExt::__init__(const char* name, const char* valu
6767
ConVar *pConVar = g_pCVar->FindVar(name);
6868
if (!pConVar)
6969
{
70+
// Find if the command already exists
71+
ConCommand* pConCommand = g_pCVar->FindCommand(name);
72+
if (pConCommand)
73+
BOOST_RAISE_EXCEPTION(PyExc_ValueError, "ConCommand already exists.")
74+
7075
ConVar* pConVar = new ConVar(strdup(name), strdup(value), flags,
7176
strdup(description), !min_value.is_none(), fMin, !max_value.is_none(), fMax);
7277

0 commit comments

Comments
 (0)