From 3877ec05e123ce3d904b72f0105b170b2aa74599 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 17 Mar 2019 16:20:34 +0100 Subject: Fix bad behaviour (and potential division by zero) if the fadelength is less than or equal to 0. --- src/drumgizmo.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc index 0e374f2..1e1974f 100644 --- a/src/drumgizmo.cc +++ b/src/drumgizmo.cc @@ -284,7 +284,14 @@ repeat: if(evt.rampdownInProgress() && evt.rampdown_offset < (evt.t + t) && evt.rampdown_count > 0) { - scale = std::min((float)evt.rampdown_count / evt.ramp_length, 1.f); + if(evt.ramp_length > 0) + { + scale = std::min((float)evt.rampdown_count / evt.ramp_length, 1.f); + } + else + { + scale = 0.0f; + } evt.rampdown_count--; } -- cgit v1.2.3