[PATCH] Check if trip is NULL before calling DIVE_TRIP
Lubomir I. Ivanov
neolit123 at gmail.com
Wed Sep 19 10:03:56 PDT 2012
From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
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 <neolit123 at gmail.com>
---
divelist.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/divelist.c b/divelist.c
index f032e62..909e27b 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;
--
1.7.11.msysgit.0
More information about the subsurface
mailing list