summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dive.c b/dive.c
index 4d4cc3e1d..5732c0f83 100644
--- a/dive.c
+++ b/dive.c
@@ -1683,6 +1683,8 @@ extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre
} else {
if (divemode == PSCR) { /* The steady state approximation should be good enough */
pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure - (1.0 - get_o2(mix) / 1000.0) * prefs.o2consumption / (prefs.bottomsac * prefs.pscr_ratio / 1000.0);
+ if (pressures->o2 < 0) // He's dead, Jim.
+ pressures->o2 = 0;
if (get_o2(mix) != 1000) {
pressures->he = (amb_pressure - pressures->o2) * get_he(mix) / (1000.0 - get_o2(mix));
pressures->n2 = (amb_pressure - pressures->o2) * (1000 - get_o2(mix) - get_he(mix)) / (1000.0 - get_o2(mix));