diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-07 13:01:34 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-04-07 13:01:34 +0200 |
commit | 331be8dc452bf47705556d2a7f7f5988973930ca (patch) | |
tree | 164a30fd5cef68a39713315085da8bd7901a1d07 /src/drumgizmo.cc | |
parent | 064f0112bd825f1102a94e109e5329710d59eb82 (diff) |
Fixed crashbug on drumkit reload.
Diffstat (limited to 'src/drumgizmo.cc')
-rw-r--r-- | src/drumgizmo.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 219ec7b..5391cdd 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -143,6 +143,8 @@ bool DrumGizmo::loadkit(std::string file) DEBUG(drumgizmo, "loadkit(%s)\n", kitfile.c_str()); + kit.clear(); + DrumKitParser parser(kitfile, kit); if(parser.parse()) { ERR(drumgizmo, "Drumkit parser failed: %s\n", kitfile.c_str()); @@ -233,6 +235,8 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) // Handle engine messages, at most one in each iteration: handleEngineEvents(); + if(!samples) return true; + ie->pre(); oe->pre(nsamples); @@ -255,9 +259,13 @@ bool DrumGizmo::run(size_t pos, sample_t *samples, size_t nsamples) } */ + if(!kit.isValid()) continue; + if(d < (int)kit.instruments.size()) { i = kit.instruments[d]; } + + if(!i->isValid()) continue; if(i == NULL) { ERR(drumgizmo, "Missing Instrument %d.\n", evs[e].instrument); |