diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-11-15 11:31:35 +0900 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-11-15 11:31:35 +0900 |
commit | 2c57568d563feb95ef67bb8480bbb839d2daaaf8 (patch) | |
tree | a301aaf2938ced718534bb4198cb8a42a8ebf69d /qt-ui/divelistview.cpp | |
parent | 0f50b73f9e885ba558b53a201f536e31a832dd22 (diff) | |
download | subsurface-2c57568d563feb95ef67bb8480bbb839d2daaaf8.tar.gz |
Fix potential crash when merging trips
strdup doesn't like to be passed a NULL pointer.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r-- | qt-ui/divelistview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index c1dde082b..b905b32be 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -431,9 +431,9 @@ void DiveListView::merge_trip(const QModelIndex &a, int offset) if (trip_a == trip_b || !trip_a || !trip_b) return; - if (!trip_a->location) + if (!trip_a->location && trip_b->location) trip_a->location = strdup(trip_b->location); - if (!trip_a->notes) + if (!trip_a->notes && trip_b->notes) trip_a->notes = strdup(trip_b->notes); while (trip_b->dives) add_dive_to_trip(trip_b->dives, trip_a); |