foxygit / doom Log in
commit f88cbbaa4ab9692f1f78acf5bc5fbc8c8e1c54f8
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Thu Nov 23 15:22:24 2017 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Thu Nov 23 15:22:37 2017 +0100

    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.
---
 midiproc/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/midiproc/main.c b/midiproc/main.c
index 391220aa..473eb4de 100644
--- a/midiproc/main.c
+++ b/midiproc/main.c
@@ -170,7 +170,10 @@ static boolean MidiPipe_RegisterSong(buffer_reader_t *reader)
         return false;
     }

-    RegisterSong(filename);
+    if (!RegisterSong(filename))
+    {
+        return false;
+    }

     if (!WriteInt16(buffer, sizeof(buffer),
                     MIDIPIPE_PACKET_TYPE_REGISTER_SONG_ACK))