mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Core: fix broken commit e5dca8228e
In commit e5dca8228e
a fixed order
of the arguments to merge_dives() was introduced: first dive old,
second dive downloaded. This made the dl variable, which pointed
to the downloaded dive useless. One instance was forgotten, which
led to a null-dereference.
Remove.
Reported-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7f49e43d76
commit
763c3683e5
1 changed files with 1 additions and 2 deletions
|
@ -3438,7 +3438,6 @@ int count_dives_with_suit(const char *suit)
|
||||||
struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip)
|
struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset, bool prefer_downloaded, struct dive_trip **trip)
|
||||||
{
|
{
|
||||||
struct dive *res = alloc_dive();
|
struct dive *res = alloc_dive();
|
||||||
const struct dive *dl = NULL;
|
|
||||||
const struct dive *preferred_trip;
|
const struct dive *preferred_trip;
|
||||||
int cylinders_map_a[MAX_CYLINDERS], cylinders_map_b[MAX_CYLINDERS];
|
int cylinders_map_a[MAX_CYLINDERS], cylinders_map_b[MAX_CYLINDERS];
|
||||||
|
|
||||||
|
@ -3480,7 +3479,7 @@ struct dive *merge_dives(const struct dive *a, const struct dive *b, int offset,
|
||||||
merge_temperatures(res, a, b);
|
merge_temperatures(res, a, b);
|
||||||
if (prefer_downloaded) {
|
if (prefer_downloaded) {
|
||||||
/* If we prefer downloaded, do those first, and get rid of "might be same" computers */
|
/* If we prefer downloaded, do those first, and get rid of "might be same" computers */
|
||||||
join_dive_computers(res, &res->dc, &dl->dc, &a->dc, cylinders_map_b, cylinders_map_a, 1);
|
join_dive_computers(res, &res->dc, &b->dc, &a->dc, cylinders_map_b, cylinders_map_a, 1);
|
||||||
} else if (offset && might_be_same_device(&a->dc, &b->dc))
|
} else if (offset && might_be_same_device(&a->dc, &b->dc))
|
||||||
interleave_dive_computers(res, &res->dc, &a->dc, &b->dc, cylinders_map_a, cylinders_map_b, offset);
|
interleave_dive_computers(res, &res->dc, &a->dc, &b->dc, cylinders_map_a, cylinders_map_b, offset);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue