mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Dive merge: don't use unset dive numbers
On merging, don't use the number of the first dive if it is 0. Use the first non-zero number. Fixes #2126 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d60ec98e8e
commit
019eeec93d
1 changed files with 7 additions and 2 deletions
|
@ -918,8 +918,13 @@ MergeDives::MergeDives(const QVector <dive *> &dives)
|
|||
d->divetrip = nullptr;
|
||||
d->dive_site = nullptr;
|
||||
|
||||
// The merged dive gets the number of the first dive
|
||||
d->number = dives[0]->number;
|
||||
// The merged dive gets the number of the first dive with a non-zero number
|
||||
for (const dive *dive: dives) {
|
||||
if (dive->number) {
|
||||
d->number = dive->number;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We will only renumber the remaining dives if the joined dives are consecutive.
|
||||
// Otherwise all bets are off concerning what the user wanted and doing nothing seems
|
||||
|
|
Loading…
Reference in a new issue