summaryrefslogtreecommitdiffstats
path: root/core/equipment.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/equipment.c')
-rw-r--r--core/equipment.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/equipment.c b/core/equipment.c
index 8d169d8d2..a5acb776d 100644
--- a/core/equipment.c
+++ b/core/equipment.c
@@ -368,7 +368,10 @@ cylinder_t *add_empty_cylinder(struct cylinder_table *t)
*/
cylinder_t *get_cylinder(const struct dive *d, int idx)
{
- if (idx < 0 || idx >= d->cylinders.nr) {
+ /* FIXME: The planner uses a dummy cylinder one past the official number of cylinders
+ * in the table to mark no-cylinder surface interavals. This is horrendous. Fix ASAP. */
+ // if (idx < 0 || idx >= d->cylinders.nr) {
+ if (idx < 0 || idx >= d->cylinders.nr + 1 || idx >= d->cylinders.allocated) {
fprintf(stderr, "Warning: accessing invalid cylinder %d (%d existing)\n", idx, d->cylinders.nr);
return NULL;
}