Fix segfault when setting forceskin to None

This commit is contained in:
Hanicef 2024-06-07 12:40:23 +02:00
parent ce1901a3bb
commit 1718361123

View file

@ -2065,11 +2065,10 @@ static void CV_SetValueMaybeStealth(consvar_t *var, INT32 value, boolean stealth
if (var == &cv_forceskin) // Special handling.
{
const char *tmpskin = NULL;
if ((value < 0) || (value >= numskins))
;
else
if (value >= 0 && value < numskins)
tmpskin = skins[value]->name;
memcpy(val, tmpskin, SKINNAMESIZE);
if (tmpskin)
memcpy(val, tmpskin, SKINNAMESIZE);
}
else
sprintf(val, "%d", value);