diff --git a/libraries/zmusic/musicformats/music_midi.cpp b/libraries/zmusic/musicformats/music_midi.cpp index 36d0754af0..d01ff7ac9e 100644 --- a/libraries/zmusic/musicformats/music_midi.cpp +++ b/libraries/zmusic/musicformats/music_midi.cpp @@ -979,6 +979,7 @@ bool MIDIStreamer::SetSubsong(int subsong) bool MIDIStreamer::ServiceStream(void* buff, int len) { + if (!MIDI) return false; return static_cast(MIDI.get())->ServiceStream(buff, len); } diff --git a/src/sound/s_music.cpp b/src/sound/s_music.cpp index 76d287ad76..2aec2c853f 100644 --- a/src/sound/s_music.cpp +++ b/src/sound/s_music.cpp @@ -277,10 +277,17 @@ void S_UpdateMusic () // [RH] Update music and/or playlist. IsPlaying() must be called // to attempt to reconnect to broken net streams and to advance the // playlist when the current song finishes. - if (!mus_playing.handle->IsPlaying() && PlayList) + if (!mus_playing.handle->IsPlaying()) { - PlayList->Advance(); - S_ActivatePlayList(false); + if (PlayList) + { + PlayList->Advance(); + S_ActivatePlayList(false); + } + else + { + S_StopMusic(true); + } } } }