[PATCH] Avoid divide by 0 error
Krzysztof Arentowicz
karent.bug at gmail.com
Thu Jan 1 15:27:31 PST 2015
Avoid crash when moving mouse to left side of the plot when showing
mean depth
Signed-off-by: Krzysztof Arentowicz <k.arentowicz at gmail.com>
---
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 e0f3ac8..887ebcd 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -990,7 +990,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));
--
1.9.1
More information about the subsurface
mailing list