Skip to content

Commit

Permalink
fix crash using SOUND_INDEX on sounds that aren't precached
Browse files Browse the repository at this point in the history
  • Loading branch information
wootguy committed Nov 6, 2024
1 parent 9ec2522 commit 574e3b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dlls/eng_wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,12 @@ int MODEL_INDEX(const char* model) {
int SOUND_INDEX(const char* sound) {
std::string lowerPath = toLowerCase(sound);
sound = lowerPath.c_str();

if (!g_precachedSounds.count(lowerPath)) {
ALERT(at_error, "SOUND_INDEX not precached: %s\n", sound);
return g_engfuncs.pfnModelIndex(NOT_PRECACHED_SOUND);
}

return g_engfuncs.pfnPrecacheSound(sound);
}

Expand Down

0 comments on commit 574e3b1

Please sign in to comment.