Skip to content

Commit

Permalink
avoid potential crash with set/seta (ie: seta alias crash)
Browse files Browse the repository at this point in the history
  • Loading branch information
timbergeron committed Sep 25, 2024
1 parent baa8cca commit f51df7f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Quake/cvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ void Cvar_Set_f (void)
return;
}
var = Cvar_Create(varname, varvalue);

if (!var) // woods -- check if Cvar_Create failed (returned nullptr)
{
Con_Printf("failed to create cvar \"%s\"", varname);
return;
}

Cvar_SetQuick(var, varvalue);

if (!strcmp(Cmd_Argv(0), "seta"))
Expand Down

0 comments on commit f51df7f

Please sign in to comment.