mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00: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 )
|
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 )
|
if( !var )
|
||||||
{
|
{
|
||||||
@ -637,6 +646,13 @@ float Cvar_VariableValue( const char *var_name )
|
|||||||
{
|
{
|
||||||
convar_t *var;
|
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 );
|
var = Cvar_FindVar( var_name );
|
||||||
if( !var ) return 0.0f;
|
if( !var ) return 0.0f;
|
||||||
|
|
||||||
@ -667,6 +683,13 @@ const char *Cvar_VariableString( const char *var_name )
|
|||||||
{
|
{
|
||||||
convar_t *var;
|
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 );
|
var = Cvar_FindVar( var_name );
|
||||||
if( !var ) return "";
|
if( !var ) return "";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user