From 9adae6909fd5295fc3c465b00224ecd4326aac7c Mon Sep 17 00:00:00 2001 From: EvanR Date: Mon, 5 Jan 2009 17:25:20 -0600 Subject: [PATCH] Fixed division by zero when using extend block. --- src/uihelper.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/uihelper.cpp b/src/uihelper.cpp index a630fc4..2f5367b 100644 --- a/src/uihelper.cpp +++ b/src/uihelper.cpp @@ -166,7 +166,13 @@ seqpat* rob_check(seqpat* s){ } else if(config.robmode == 1 || prev == NULL){ int pos = get_play_position(); - int M = config.measures_per_phrase*config.beats_per_measure*128; + int M = config.measures_per_phrase; + if(M!=0){ + M = M*config.beats_per_measure*128; + } + else{ + M = 4*config.beats_per_measure*128; + } int P1 = pos/M*M; int P2 = P1 + M; int T = P1; @@ -188,7 +194,13 @@ seqpat* rob_check(seqpat* s){ } else if(config.robmode == 2){ int pos = get_play_position(); - int M = config.measures_per_phrase*config.beats_per_measure*128; + int M = config.measures_per_phrase; + if(M!=0){ + M = M*config.beats_per_measure*128; + } + else{ + M = 4*config.beats_per_measure*128; + } int P = pos/M*M + M;//tick at next phrase boundary int W = P - s->tick; if(s->next){ -- 2.11.4.GIT