aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-07 07:22:41 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-07 07:22:41 -0800
commit2df1e0b3429078dbbfe214ecc4e2a4e6339d2d64 (patch)
tree442c945b27084e66e66daeeb5edf797d6f45b24f
parent17134be96d42fe36ac882b59cd50cf5105ae1399 (diff)
downloadsubsurface-2df1e0b3429078dbbfe214ecc4e2a4e6339d2d64.tar.gz
Don't run time consuming gas interpolation without any data
If the user hasn't set any pressures at all there is no point in trying to interpolate all these data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/gaspressures.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/subsurface-core/gaspressures.c b/subsurface-core/gaspressures.c
index 5f46d6080..66ec7e3aa 100644
--- a/subsurface-core/gaspressures.c
+++ b/subsurface-core/gaspressures.c
@@ -369,6 +369,18 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
pr_track_t *track_pr[MAX_CYLINDERS] = { NULL, };
pr_track_t *current = NULL;
bool missing_pr = false;
+ bool found_any_pr_data = false;
+
+ /* if we have no pressure data whatsoever, this is pointless, so let's just return */
+ for (i = 0; i < MAX_CYLINDERS; i++) {
+ if (dive->cylinder[i].start.mbar || dive->cylinder[i].sample_start.mbar ||
+ dive->cylinder[i].end.mbar || dive->cylinder[i].sample_end.mbar) {
+ found_any_pr_data = true;
+ break;
+ }
+ }
+ if (!found_any_pr_data)
+ return;
for (i = 0; i < pi->nr; i++) {
struct plot_data *entry = pi->entry + i;