EFX/env_sound: Add bound checks for legacy roomtypes.
This commit is contained in:
parent
f09f5833e0
commit
ead2ab6a6b
2 changed files with 12 additions and 3 deletions
|
@ -156,9 +156,13 @@ EFX_Load(string efx_file)
|
||||||
void
|
void
|
||||||
EFX_SetEnvironment(int id)
|
EFX_SetEnvironment(int id)
|
||||||
{
|
{
|
||||||
if (g_iEFX == id) {
|
/* out of bounds... MAP BUG! */
|
||||||
|
if (id >= g_efx_count)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* same as before, skip */
|
||||||
|
if (g_iEFX == id)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
g_iEFXold = g_iEFX;
|
g_iEFXold = g_iEFX;
|
||||||
g_iEFX = id;
|
g_iEFX = id;
|
||||||
|
|
|
@ -94,7 +94,12 @@ env_sound::SpawnKey(string strField, string strKey)
|
||||||
/* GoldSrc, legacy */
|
/* GoldSrc, legacy */
|
||||||
case "roomtype":
|
case "roomtype":
|
||||||
int efx_alias = stoi(strKey);
|
int efx_alias = stoi(strKey);
|
||||||
m_iRoomType = EFX_Load(g_hlefx[efx_alias]);
|
|
||||||
|
if (efx_alias >= g_hlefx.length) {
|
||||||
|
print("^1env_sound::SpawnKey: Invalid roomtype!\n");
|
||||||
|
m_iRoomType = 0;
|
||||||
|
} else
|
||||||
|
m_iRoomType = EFX_Load(g_hlefx[efx_alias]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CBaseEntity::SpawnKey(strField, strKey);
|
CBaseEntity::SpawnKey(strField, strKey);
|
||||||
|
|
Loading…
Reference in a new issue