summaryrefslogtreecommitdiff
path: root/src/drumkitloader.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-02-11 17:13:51 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2019-02-11 17:18:21 +0100
commit96c059c3354d26a1bbebd389fb827322aaf1d0ec (patch)
tree814bf202023f3c0b24f493bc16dee4a110514473 /src/drumkitloader.cc
parent43c2a51331d3e91d86ef50c5262920bdaa260925 (diff)
Fix division by zero crash if drumkit without files is being loaded.
Diffstat (limited to 'src/drumkitloader.cc')
-rw-r--r--src/drumkitloader.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc
index 2ad6b0e..77b7021 100644
--- a/src/drumkitloader.cc
+++ b/src/drumkitloader.cc
@@ -207,9 +207,9 @@ void DrumKitLoader::loadKit(DrumKit *kit)
DEBUG(loader, "cache_enable: %s\n", cache_enable?"true":"false");
- if(cache_enable)
+ auto number_of_files = kit->getNumberOfFiles();
+ if(cache_enable && number_of_files > 0)
{
- auto number_of_files = kit->getNumberOfFiles();
auto cache_limit_per_file = cache_limit / number_of_files;
assert(framesize != 0);