diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-09-20 07:54:28 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-09-20 07:54:28 -0700 |
commit | a77d1a3f56c5c5da57dd817507979f63ac6e4761 (patch) | |
tree | 97ecf07f0b638b077e6d6dc2800c5b31b8d00863 /profile.c | |
parent | e4d2092f339008b2a0180e57501e85683f20aba0 (diff) | |
download | subsurface-a77d1a3f56c5c5da57dd817507979f63ac6e4761.tar.gz |
Warn about non-monotonous plot data and prevent infinite loop
The data are supposed to be sorted with monotonous time stamp. And while
the actual bug that causes this needs to be identified and fixed, this is
at least a stop gap measure that shows the issue and prevents Subsurface
from hanging.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -849,6 +849,12 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru (prefs.gflow - prefs.gfhigh) + prefs.gfhigh) * (100.0 - AMB_PERCENTAGE) / 100.0 + AMB_PERCENTAGE; + if (t0 > t1) { + fprintf(stderr, "non-monotonous dive stamps %d %d\n", t0, t1); + int xchg = t1; + t1 = t0; + t0 = xchg; + } if (t0 != t1 && t1 - t0 < time_stepsize) time_stepsize = t1 - t0; for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) { |