summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2012-09-19 20:03:56 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-09-19 14:07:14 -0400
commitbf83aa21046e7dfe63cb3bd13ea608067400967e (patch)
tree94e98364ddcd3c8b0402cc72c831a6ba2b391cce
parentd14932058f191de2a812a9b3b9ad87c5febd2b3e (diff)
downloadsubsurface-bf83aa21046e7dfe63cb3bd13ea608067400967e.tar.gz
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 <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--divelist.c3
1 files changed, 2 insertions, 1 deletions
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;