mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-16 14:10:11 +01:00
engine: cvar: add null checks as these functions are passed to user's DLL
This commit is contained in:
parent
0c3be639c5
commit
ecd675926a
@ -590,7 +590,16 @@ Cvar_Set
|
||||
*/
|
||||
void Cvar_Set( const char *var_name, const char *value )
|
||||
{
|
||||
convar_t *var = Cvar_FindVar( var_name );
|
||||
convar_t *var;
|
||||
|
||||
if( !var_name )
|
||||
{
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf( "Cvar_Set: passed NULL variable name\n", var_name );
|
||||
return;
|
||||
}
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
|
||||
if( !var )
|
||||
{
|
||||
@ -637,6 +646,13 @@ float Cvar_VariableValue( const char *var_name )
|
||||
{
|
||||
convar_t *var;
|
||||
|
||||
if( !var_name )
|
||||
{
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf( "Cvar_VariableValue: passed NULL variable name\n", var_name );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
if( !var ) return 0.0f;
|
||||
|
||||
@ -667,6 +683,13 @@ const char *Cvar_VariableString( const char *var_name )
|
||||
{
|
||||
convar_t *var;
|
||||
|
||||
if( !var_name )
|
||||
{
|
||||
// there is an error in C code if this happens
|
||||
Con_Printf( "Cvar_VariableString: passed NULL variable name\n", var_name );
|
||||
return "";
|
||||
}
|
||||
|
||||
var = Cvar_FindVar( var_name );
|
||||
if( !var ) return "";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user