From a2b3d0ff0604fde45c1b2efe5fd8d0ca6c410e76 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 3 Nov 2018 17:32:20 +0100 Subject: [PATCH] Undo: fix addition of multiple dives The generic addInBatches() function is used to add batches of contiguous sets of dives to the dive-list models. The loop searching for the end of the batch used the wrong index and would therefore not properly cut the batches. Fix this. Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 5cbb6a118..33f0dd46c 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -717,7 +717,7 @@ void addInBatches(Vector1 &v1, const Vector2 &v2, Comparator comp, Inserter inse // We were at end -> insert the remaining items j = v2.size(); } else { - for (j = i + 1; j < (int)v2.size() && comp(v2[i], v1[idx]); ++j) + for (j = i + 1; j < (int)v2.size() && comp(v2[j], v1[idx]); ++j) ; // Pass }