Cleanup: More Fixes for Problems Reported by Coverity.

Fix the problem another way as Coverity was still not happy with it.

Signed-off-by: Michael Keller <mikeller@042.ch>
This commit is contained in:
Michael Keller 2024-04-26 11:04:05 +12:00 committed by Michael Keller
parent a2cd621819
commit bb00a9728f

View file

@ -762,7 +762,8 @@ static void setup_gas_sensor_pressure(const struct dive *dive, const struct dive
std::vector<int> last(num_cyl, INT_MAX);
const struct divecomputer *secondary;
unsigned prev = (unsigned)explicit_first_cylinder(dive, dc);
int prev = explicit_first_cylinder(dive, dc);
prev = prev >= 0 ? prev : 0;
seen[prev] = 1;
for (ev = get_next_event(dc->events, "gaschange"); ev != NULL; ev = get_next_event(ev->next, "gaschange")) {