summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/command_divelist.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp
index 6eac339f2..eedac4b6e 100644
--- a/commands/command_divelist.cpp
+++ b/commands/command_divelist.cpp
@@ -271,7 +271,8 @@ static OwningTripPtr moveDiveToTrip(DiveToTrip &diveToTrip)
// Store old trip and get new trip we should associate this dive with
std::swap(trip, diveToTrip.trip);
- add_dive_to_trip(diveToTrip.dive, trip);
+ if (trip)
+ add_dive_to_trip(diveToTrip.dive, trip);
invalidate_dive_cache(diveToTrip.dive); // Ensure that dive is written in git_save()
return res;
}