foxygit / doom Log in
commit ca2a6aee59f8bf0960cca15e8f8d681f92bb1f11
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu May 1 01:54:23 2014 -0400
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu May 1 01:54:23 2014 -0400

    opl: Fix crash when using OPL music.

    The previous change to add the poll method to the music module
    interface introduced a crash, as the OPL music struct does not
    define a poll method.
---
 src/i_oplmusic.c | 1 +
 src/i_sound.c    | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index 142e401a..678b275f 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -1479,6 +1479,7 @@ music_module_t music_opl_module =
     I_OPL_PlaySong,
     I_OPL_StopSong,
     I_OPL_MusicIsPlaying,
+    NULL,  // Poll
 };

 //----------------------------------------------------------------------
diff --git a/src/i_sound.c b/src/i_sound.c
index 1b61f06f..f107de69 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -279,7 +279,7 @@ void I_UpdateSound(void)
         sound_module->Update();
     }

-    if (music_module != NULL)
+    if (music_module != NULL && music_module->Poll != NULL)
     {
         music_module->Poll();
     }