mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
Dive merge: don't pick an empty dive site
When merging, we should treat an empty dive site (which will be deleted on save) the same as not having a dive site. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3fef6ec31d
commit
da50bb1ae5
1 changed files with 5 additions and 1 deletions
|
@ -3167,7 +3167,11 @@ struct dive *merge_dives(struct dive *a, struct dive *b, int offset, bool prefer
|
||||||
interleave_dive_computers(&res->dc, &a->dc, &b->dc, offset);
|
interleave_dive_computers(&res->dc, &a->dc, &b->dc, offset);
|
||||||
else
|
else
|
||||||
join_dive_computers(&res->dc, &a->dc, &b->dc, 0);
|
join_dive_computers(&res->dc, &a->dc, &b->dc, 0);
|
||||||
res->dive_site_uuid = a->dive_site_uuid ?: b->dive_site_uuid;
|
/* we take the first dive site, unless it's empty */
|
||||||
|
if (a->dive_site_uuid && !dive_site_is_empty(get_dive_site_by_uuid(a->dive_site_uuid)))
|
||||||
|
res->dive_site_uuid = a->dive_site_uuid;
|
||||||
|
else
|
||||||
|
res->dive_site_uuid = b->dive_site_uuid;
|
||||||
fixup_dive(res);
|
fixup_dive(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue