summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.cpp
diff options
context:
space:
mode:
authorGravatar Krzysztof Arentowicz <karent.bug@gmail.com>2015-01-02 00:27:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-01 16:14:01 -0800
commitee1ef5233036be26ab28228465985f1cf71ba157 (patch)
tree5df607e0ad4f1dfa2dc28297df1d8fa3d874c3df /qt-ui/profile/diveprofileitem.cpp
parent26c3dcbcb69495f67207b70cf81512c855d79cbf (diff)
downloadsubsurface-ee1ef5233036be26ab28228465985f1cf71ba157.tar.gz
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>
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp2
1 files changed, 1 insertions, 1 deletions
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));