From c3047f448ef153fe6badc55a80c0c4bcfa93dfa4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 27 Jan 2016 10:39:21 +0100 Subject: [PATCH] - fixed: When MIDI->Open returns failure, the MIDI device needs to be deleted. Otherwise the dead device object can trigger an assert later. --- src/sound/music_midistream.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sound/music_midistream.cpp b/src/sound/music_midistream.cpp index 579fd7851..dd9e0e0ec 100644 --- a/src/sound/music_midistream.cpp +++ b/src/sound/music_midistream.cpp @@ -344,6 +344,11 @@ void MIDIStreamer::Play(bool looping, int subsong) if (MIDI == NULL || 0 != MIDI->Open(Callback, this)) { Printf(PRINT_BOLD, "Could not open MIDI out device\n"); + if (MIDI != NULL) + { + delete MIDI; + MIDI = NULL; + } return; }