From ee1ef5233036be26ab28228465985f1cf71ba157 Mon Sep 17 00:00:00 2001 From: Krzysztof Arentowicz Date: Fri, 2 Jan 2015 00:27:31 +0100 Subject: [PATCH] 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 03a2451a2..57873e9c2 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -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));