summaryrefslogtreecommitdiffstats
path: root/qt-ui/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-05 15:38:41 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-05 15:44:16 +0900
commite90f5c28df8e609c22ff2f7d52a00b56c5eaa1db (patch)
tree5019aeabbbd2ce5db9a09da6ca61fa71dbafd453 /qt-ui/divelistview.cpp
parent01d515b5d8c2988518f8a4a016fb6493c4639e7b (diff)
downloadsubsurface-e90f5c28df8e609c22ff2f7d52a00b56c5eaa1db.tar.gz
Fix dive merging
When merging dives, the indices of the following dives change - so we need to adjust the variable used in the for_each loop. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/divelistview.cpp')
-rw-r--r--qt-ui/divelistview.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp
index a78e48777..92a10ca38 100644
--- a/qt-ui/divelistview.cpp
+++ b/qt-ui/divelistview.cpp
@@ -309,10 +309,12 @@ void DiveListView::mergeDives()
for_each_dive(i, dive) {
if (dive->selected) {
- if (!maindive)
+ if (!maindive) {
maindive = dive;
- else
+ } else {
maindive = merge_two_dives(maindive, dive);
+ i--; // otherwise we skip a dive in the freshly changed list
+ }
}
}
mainWindow()->refreshDisplay();