Prevent theoretical out of bounds access

When I stare at the code enough I can convince myself that cylinderindex
will always be assigned a sane value, but on the flip side, making sure
nothing stupid happens is cheap insurance.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-21 21:17:42 -07:00
parent f5726c3d18
commit ce1be9c2eb

View file

@ -417,7 +417,8 @@ void populate_pressure_information(struct dive *dive, struct divecomputer *dc, s
/* transmitter stopped transmitting cylinder pressure data */
current = pr_track_alloc(pressure, entry->sec);
track_pr[cylinderindex] = list_add(track_pr[cylinderindex], current);
if (cylinderindex >= 0)
track_pr[cylinderindex] = list_add(track_pr[cylinderindex], current);
}
if (missing_pr) {