diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-01-21 21:43:07 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-21 14:07:10 -0800 |
commit | 2f822ec0dcd2d715bf4234023b510aed9fe90f0b (patch) | |
tree | 0b787fc3062e3e0f06e637255b38687284867c58 /qt-ui/profile/divecartesianaxis.cpp | |
parent | 4159faa950dbb5c826987402f5b670af3aa013a7 (diff) | |
download | subsurface-2f822ec0dcd2d715bf4234023b510aed9fe90f0b.tar.gz |
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 <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divecartesianaxis.cpp')
-rw-r--r-- | qt-ui/profile/divecartesianaxis.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
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() : |