aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c
index 19a950482..3c2c2afde 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -2061,8 +2061,15 @@ static void merge_cylinders(struct dive *res, struct dive *a, struct dive *b)
mapping[j] = i;
++j;
}
- while (j < MAX_CYLINDERS)
+ bool warn = false;
+ while (j < MAX_CYLINDERS) {
+ if (is_cylinder_used(b, j))
+ warn = true;
mapping[j++] = 0;
+ }
+ if (warn) {
+ report_error("Could not merge all cylinders as number exceeds %d", MAX_CYLINDERS);
+ }
cylinder_renumber(b, mapping);
}
}