From bf83aa21046e7dfe63cb3bd13ea608067400967e Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Wed, 19 Sep 2012 20:03:56 +0300 Subject: [PATCH] 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 d14932058f191de2a Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- divelist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/divelist.c b/divelist.c index f032e6243..909e27bea 100644 --- a/divelist.c +++ b/divelist.c @@ -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;