From c6d626c618eccca81897833df8ef672aeb503a15 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 25 Jan 2018 11:44:26 +0100 Subject: 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 --- core/planner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2