From 3fab68dcd3689d795248dfc5bb0c98b72b424252 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 3 Nov 2014 07:50:30 -0800 Subject: Fix two more potential crashes for dives without samples This should be all of them (famous last words). Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveeventitem.cpp | 2 +- statistics.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index cceaaa5e7..38f359908 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -131,7 +131,7 @@ bool DiveEventItem::shouldBeHidden() * Don't bother showing those */ struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0]; - if (!strcmp(event->name, "gaschange") && event->time.seconds == first_sample->time.seconds) + if (!strcmp(event->name, "gaschange") && first_sample && event->time.seconds == first_sample->time.seconds) return true; for (int i = 0; i < evn_used; i++) { diff --git a/statistics.c b/statistics.c index 4023cdc85..17667f899 100644 --- a/statistics.c +++ b/statistics.c @@ -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; -- cgit v1.2.3-70-g09d2