summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--desktop-widgets/divelistview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index a6f1531af..eb225e593 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -684,9 +684,12 @@ void DiveListView::removeFromTrip()
struct dive *d;
QMap<struct dive*, dive_trip*> divesToRemove;
for_each_dive (i, d) {
- if (d->selected)
+ if (d->selected && d->divetrip)
divesToRemove.insert(d, d->divetrip);
}
+ if (divesToRemove.isEmpty())
+ return;
+
UndoRemoveDivesFromTrip *undoCommand = new UndoRemoveDivesFromTrip(divesToRemove);
MainWindow::instance()->undoStack->push(undoCommand);