diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | core/dive.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f14b5350..e12c2a74d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +- core: Gracefully handle infinte MND for oxygen - mobile: add location service warning as required by Google Play - mobile: fix manually adding dives in the past [#2971] diff --git a/core/dive.c b/core/dive.c index 177c91990..6ac70da71 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3253,7 +3253,11 @@ depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int rou int maxambient = prefs.o2narcotic ? (int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0)) : - (int)lrint(ppo2n2.mbar * N2_IN_AIR / get_n2(mix)); + get_n2(mix) > 0 ? + (int)lrint(ppo2n2.mbar * N2_IN_AIR / get_n2(mix)) + : + // Actually: Infinity + 1000000; rounded_depth.mm = (int)lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto; return rounded_depth; } |