shithub: choc

Download patch

ref: f88cbbaa4ab9692f1f78acf5bc5fbc8c8e1c54f8
parent: b90a9e58380e690d97e95699e8e4c66ce2765574
author: Fabian Greffrath <[email protected]>
date: Thu Nov 23 10:22:24 EST 2017

midiproc: consider the case that RegisterSong() fails

More specifically, because Mix_LoadMUS() fails, e.g. because it does not
recognize the music lump's file format. Music lumps are not always in
MUS or MIDI format nowadays, so let other code handle that.

--- a/midiproc/main.c
+++ b/midiproc/main.c
@@ -170,7 +170,10 @@
         return false;
     }
 
-    RegisterSong(filename);
+    if (!RegisterSong(filename))
+    {
+        return false;
+    }
 
     if (!WriteInt16(buffer, sizeof(buffer),
                     MIDIPIPE_PACKET_TYPE_REGISTER_SONG_ACK))