Skip to content

Commit

Permalink
fix client crash
Browse files Browse the repository at this point in the history
playing an ambient sound that isn't precached
  • Loading branch information
wootguy committed Dec 9, 2024
1 parent 83c3cc7 commit 2c03928
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dlls/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,12 @@ void UTIL_EmitAmbientSound( edict_t *entity, const float* vecOrigin, const char
}
}

if (!g_precachedSounds.count(toLowerCase(samp))) {
// client crash if you try to play this sound
ALERT(at_console, "EmitAmbientSound not precached: %s\n", samp);
return;
}

if (dest) {
if (UTIL_isSafeEntIndex(dest, ENTINDEX(entity), "play ambient sound")) {
ambientsound_msg(entity, rgfl, samp, vol, attenuation, fFlags, pitch, MSG_ONE, dest);
Expand Down

0 comments on commit 2c03928

Please sign in to comment.