Fix two more potential crashes for dives without samples

This should be all of them (famous last words).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-11-03 07:50:30 -08:00
parent 9eb55a0fc6
commit 3fab68dcd3
2 changed files with 2 additions and 2 deletions

View file

@ -302,7 +302,7 @@ bool is_cylinder_used(struct dive *dive, int idx)
for_each_dc(dive, dc) {
struct event *event = get_next_event(dc->events, "gaschange");
while (event) {
if (event->time.seconds == dc->sample[0].time.seconds)
if (dc->sample && event->time.seconds == dc->sample[0].time.seconds)
firstGasExplicit = true;
if (get_cylinder_index(dive, event) == idx)
return true;