Add guard against null-audio in init playback

This commit is contained in:
Doyle Thai 2016-11-26 13:34:23 +11:00
parent d49811358a
commit 91cc891b36

View File

@ -272,6 +272,8 @@ const i32 audio_playVorbis(MemoryArena_ *arena, AudioManager *audioManager,
AudioRenderer *audioRenderer, AudioVorbis *vorbis, AudioRenderer *audioRenderer, AudioVorbis *vorbis,
i32 numPlays) i32 numPlays)
{ {
if(vorbis) return -1;
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer, i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
vorbis, numPlays); vorbis, numPlays);
@ -302,6 +304,8 @@ const i32 audio_streamPlayVorbis(MemoryArena_ *arena, AudioManager *audioManager
// TODO(doyle): Streaming leaks memory, we don't free the "copy audio" // TODO(doyle): Streaming leaks memory, we don't free the "copy audio"
ASSERT(INVALID_CODE_PATH); ASSERT(INVALID_CODE_PATH);
if(vorbis) return -1;
i32 result = initRendererForPlayback(arena, audioManager, audioRenderer, i32 result = initRendererForPlayback(arena, audioManager, audioRenderer,
vorbis, numPlays); vorbis, numPlays);
// NOTE(doyle): We make a copy of the audio vorbis file using all the same // NOTE(doyle): We make a copy of the audio vorbis file using all the same