Skip to content

Commit

Permalink
Fix callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
angstsmurf committed Jun 12, 2019
1 parent c39cb40 commit 032702c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions garglk/sndsdl.c
Expand Up @@ -410,13 +410,12 @@ void glk_schannel_set_volume_ext(schanid_t chan, glui32 vol,
/* Notify the music channel completion */
static void music_completion_callback()
{
if (!music_channel)
if (!music_channel || !music_channel->resid)
{
gli_strict_warning("music callback failed");
return;
}

if (music_channel->notify && music_channel->resid)
else
{
gli_event_store(evtype_SoundNotify, 0, music_channel->resid,
music_channel->notify);
Expand All @@ -428,15 +427,10 @@ static void music_completion_callback()
static void sound_completion_callback(int chan)
{
channel_t *sound_channel = sound_channels[chan];
if (!sound_channel || Mix_Playing(chan))
{
gli_strict_warning("sound callback failed");

if (!sound_channel)
fprintf(stderr, "sound_channel %d is NULL\n", chan);
if (Mix_Playing(chan))
{
fprintf(stderr, "Mix_Playing(%d) is TRUE\n", chan);
}
fprintf(stderr, "sound_completion_callback called with invalid sound_channel %d\n", chan);
return;
}

Expand Down

0 comments on commit 032702c

Please sign in to comment.