mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: always create a fake profile if there are no samples
Before making the cylinder-table dynamic, dives always
had at least one cylinger. When such a dive is displayed,
the TabDiveInformation class calls per_cylinder_mean_depth().
If there are no samples, this function generates a "fake
profile" with fake_dc(). Thus, effectively dives always
had samples once the user was displaying them.
When the cylinder-table was made dynamic, dives without
cylinders were supported. This can notably happen, when
importing from CSV (this could actually be a bug).
per_cylinder_mean_depth() exits early in that case and
doesn't create a fake profile. This lead to crashes
of the profile-widget, which were fixed in 6b2e56e513.
Non-sample dives were now shown with the Subsurface-logo.
To restore the previous behavior, genarate a fake profile
for sample-less dives in fixup_dive(), which is called
anytime a dive is loaded or imported. This seems to
have been the intention anyway and this worked only
"by chance". This will make a few fake_dc() calls obsolete,
but so be it.
Since fake profiles are now generated on loading,
the parse-tests need to be fixed to account for that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
72bdd506f0
commit
846e1ba53e
2 changed files with 35 additions and 7 deletions
|
|
@ -1246,6 +1246,10 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
|
|||
|
||||
/* Fixup CCR / PSCR dives with o2sensor values, but without no_o2sensors */
|
||||
fixup_no_o2sensors(dc);
|
||||
|
||||
/* If there are no samples, generate a fake profile based on depth and time */
|
||||
if (!dc->samples)
|
||||
fake_dc(dc);
|
||||
}
|
||||
|
||||
struct dive *fixup_dive(struct dive *dive)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue