From 2f822ec0dcd2d715bf4234023b510aed9fe90f0b Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 21 Jan 2014 21:43:07 +0100 Subject: Prevent potential math overflow in new profile Test for max_temp == min_temp to prevent math overflow when calculating temperature axis in new profile Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- qt-ui/profile/divecartesianaxis.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'qt-ui') diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp index fdcfff3c6..505b60d7e 100644 --- a/qt-ui/profile/divecartesianaxis.cpp +++ b/qt-ui/profile/divecartesianaxis.cpp @@ -184,7 +184,8 @@ qreal DiveCartesianAxis::posAtValue(qreal value) double size = max - min; // unused for now: // double distanceFromOrigin = value - min; - double percent = (value - min) / size; + double percent = IS_FP_SAME(min,max) ? 0.0 : (value - min) / size; + double realSize = orientation == LeftToRight || orientation == RightToLeft? m.x2() - m.x1() : -- cgit v1.2.3-70-g09d2