diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 7ed7a7124..bbc56a93d 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -1245,10 +1245,10 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO case SOURCE_Unattached: chan->Point[0] = pt->X; chan->Point[1] = pt->Y; chan->Point[2] = pt->Z; break; default: break; } - } - if (spitch > 0.0) - S_SetPitch(chan, spitch); + if (spitch > 0.0) + S_SetPitch(chan, spitch); + } return chan; } @@ -1889,6 +1889,7 @@ void S_ChangeSoundPitch(AActor *actor, int channel, double pitch) void S_SetPitch(FSoundChan *chan, float pitch) { + assert(chan != nullptr); GSnd->ChannelPitch(chan, MAX(0.0001f, pitch)); chan->Pitch = MAX(1, int(float(NORM_PITCH) * pitch)); }