diff --git a/src/gamedata/d_dehacked.cpp b/src/gamedata/d_dehacked.cpp index b0231627c..78efd6c83 100644 --- a/src/gamedata/d_dehacked.cpp +++ b/src/gamedata/d_dehacked.cpp @@ -152,9 +152,12 @@ static PClassActor* FindInfoName(int index, bool mustexist = false) static FSoundID DehFindSound(int index,bool mustexist = false) { if (index < 0) return NO_SOUND; - if (index < (int) SoundMap.Size()) return SoundMap[index]; - FStringf name("~dsdhacked/#%d", index); - if (dsdhacked && !mustexist) return soundEngine->FindSoundTentative(name.GetChars()); + if (index < (int) SoundMap.Size() && SoundMap[index].isvalid()) return SoundMap[index]; + if (dsdhacked && !mustexist) + { + FStringf name("~dsdhacked/#%d", index); + return soundEngine->FindSoundTentative(name.GetChars()); + } return NO_SOUND; } @@ -1476,7 +1479,7 @@ static int PatchThing (int thingy) } else if (stricmp (Line1 + linelen - 6, " sound") == 0) { - FSoundID snd = DehFindSound(val - 1); + FSoundID snd = DehFindSound(val - 1, false); if (snd == NO_SOUND) // This won't trigger for dsdhacked patches! {