Avoid divide by 0 error

Avoid crash when moving mouse to left side of the plot when showing
mean depth

Signed-off-by: Krzysztof Arentowicz <k.arentowicz@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Krzysztof Arentowicz 2015-01-02 00:27:31 +01:00 committed by Dirk Hohndel
parent 26c3dcbcb6
commit ee1ef52330

View file

@ -943,7 +943,7 @@ void InstantMeanDepthLine::mouseMoved(int time, int depth)
int count = model->data().nr;
for(int i = 0; i < count; i++){
struct plot_data pI = model->data().entry[i];
if (pI.sec == time) {
if (pI.sec == time && pI.sec != 0) {
setMeanDepth(pI.running_sum / time);
setLine(0, 0, hAxis->posAtValue(time), 0);
setPos(pos().x(), vAxis->posAtValue(pI.running_sum / time));