mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
4159faa950
commit
2f822ec0dc
3 changed files with 46 additions and 1 deletions
|
@ -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() :
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue