From b26fa4b410f6ebcb5bb82a0ed26ab4e0749e3064 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 20 Oct 2006 18:29:00 +0000 Subject: [PATCH] correctly return NullAudioSound if unable to load file --- panda/src/audiotraits/milesAudioManager.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/panda/src/audiotraits/milesAudioManager.cxx b/panda/src/audiotraits/milesAudioManager.cxx index e2e3e58f63..898dd7da89 100644 --- a/panda/src/audiotraits/milesAudioManager.cxx +++ b/panda/src/audiotraits/milesAudioManager.cxx @@ -275,6 +275,7 @@ load(Filename file_name) { } else if ((int)sd->_raw_data.size() >= miles_audio_expand_mp3_threshold) { audio_debug(sd->_basename << " is too large to expand in-memory."); } else { + audio_debug(sd->_basename << " will be expanded in-memory."); expand_to_wav = true; } @@ -376,9 +377,13 @@ get_sound(const string& file_name, bool) { bool inserted = _sounds_on_loan.insert(milesAudioSound).second; nassertr(inserted, milesAudioSound.p()); audioSound=milesAudioSound; + + _hasMidiSounds |= (file_name.find(".mid")!=string::npos); + } else { + // Couldn't load the file; just return a NullAudioSound. + audioSound = new NullAudioSound; } - _hasMidiSounds |= (file_name.find(".mid")!=string::npos); audio_debug(" returning 0x" << (void*)audioSound); assert(is_valid()); return audioSound;