From 331be8dc452bf47705556d2a7f7f5988973930ca Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 7 Apr 2013 13:01:34 +0200 Subject: Fixed crashbug on drumkit reload. --- src/drumkitloader.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/drumkitloader.cc') diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index ed1a187..45dcec3 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -68,6 +68,7 @@ void DrumKitLoader::loadKit(DrumKit *kit) } + void DrumKitLoader::thread_main() { while(1) { @@ -79,10 +80,14 @@ void DrumKitLoader::thread_main() if(quitit) return; unsigned int count = 0; + + if(!kit->isValid()) goto finish; + { // Count total number of files that need loading: Instruments::iterator i = kit->instruments.begin(); while(i != kit->instruments.end()) { Instrument *instr = *i; + if(!instr->isValid()) goto finish; count += instr->audiofiles.size(); i++; @@ -95,6 +100,8 @@ void DrumKitLoader::thread_main() while(i != kit->instruments.end()) { Instrument *instr = *i; + if(!instr->isValid()) goto finish; + std::vector::iterator a = instr->audiofiles.begin(); while(a != instr->audiofiles.end()) { #if 0 @@ -105,6 +112,9 @@ void DrumKitLoader::thread_main() #endif/*WIN32*/ #endif AudioFile *af = *a; + + if(!af->isValid()) goto finish; + af->load(); loaded++; @@ -124,6 +134,9 @@ void DrumKitLoader::thread_main() mutex.lock(); is_done = true; mutex.unlock(); + + finish: + continue; } } -- cgit v1.2.3