summaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-01-25 11:44:26 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2018-01-26 07:04:45 +0100
commitc6d626c618eccca81897833df8ef672aeb503a15 (patch)
treedb1cc7633a7a1373ad60c4762d61021775a25c68 /core/planner.c
parent6d3c2327bd6a7bfdb283fe2e681aff2449327f89 (diff)
downloadsubsurface-c6d626c618eccca81897833df8ef672aeb503a15.tar.gz
Limit recreational dives to 6 hours
Otherwise, with large gradient factors, one can have infinite NDL which result in an infinite loop when no gas is set. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/planner.c b/core/planner.c
index 6b9b075ea..3a66f2bfa 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -782,7 +782,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
clock += timestep;
} while (trial_ascent(ds, 0, depth, 0, avg_depth, bottom_time, &dive->cylinder[current_cylinder].gasmix,
po2, diveplan->surface_pressure / 1000.0, dive) &&
- enough_gas(current_cylinder));
+ enough_gas(current_cylinder) && clock < 6 * 3600);
// We did stay one DECOTIMESTEP too many.
// In the best of all worlds, we would roll back also the last add_segment in terms of caching deco state, but