From 962b43d2bd999c86eec5520e9c0d947242461d07 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 18 Mar 2016 15:09:02 +0100 Subject: [PATCH] Fixed: Possible crashes if ov_info returns NULL --HG-- branch : develop --- code/nel/src/sound/audio_decoder_vorbis.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/nel/src/sound/audio_decoder_vorbis.cpp b/code/nel/src/sound/audio_decoder_vorbis.cpp index e438d43cc..1c11c32d7 100644 --- a/code/nel/src/sound/audio_decoder_vorbis.cpp +++ b/code/nel/src/sound/audio_decoder_vorbis.cpp @@ -195,13 +195,17 @@ uint32 CAudioDecoderVorbis::getNextBytes(uint8 *buffer, uint32 minimum, uint32 m uint8 CAudioDecoderVorbis::getChannels() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint8)vi->channels; + if (vi) return (uint8)vi->channels; + nlwarning("ov_info returned NULL"); + return 0; } uint CAudioDecoderVorbis::getSamplesPerSec() { vorbis_info *vi = ov_info(&_OggVorbisFile, -1); - return (uint)vi->rate; + if (vi) return (uint)vi->rate; + nlwarning("ov_info returned NULL"); + return 0; } uint8 CAudioDecoderVorbis::getBitsPerSample()