Check if trip is NULL before calling DIVE_TRIP

Other places have this check, but for this particular one a crash
can be reproduced:

./subsurface ./dives/*
log -> autogroup
log -> autogroup

Against d14932058f

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Lubomir I. Ivanov 2012-09-19 20:03:56 +03:00 committed by Dirk Hohndel
parent d14932058f
commit bf83aa2104

View file

@ -1067,7 +1067,8 @@ static void fill_dive_list(void)
}
} else if (DIVE_IN_TRIP(dive)) {
trip = find_matching_trip(dive->when);
dive_trip = DIVE_TRIP(trip);
if (trip)
dive_trip = DIVE_TRIP(trip);
} else {
/* dive is not in a trip and we aren't autogrouping */
dive_trip = NULL;