From 846e1ba53e32aaeae22b72d4a7843700627f2b27 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 15 Jul 2021 09:14:31 +0200 Subject: 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 6b2e56e5131. 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 Signed-off-by: Dirk Hohndel --- dives/test40-42.xml | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'dives') diff --git a/dives/test40-42.xml b/dives/test40-42.xml index f7dc034e4..727aa5475 100644 --- a/dives/test40-42.xml +++ b/dives/test40-42.xml @@ -6,32 +6,56 @@ - + Dirk wet, 5mm - + + + + + + + - + Linus wet, shorty, 3mm - + + + + + + + Tomaz none - + + + + + + + - + Don dry, Whites Fusion - + + + + + + + -- cgit v1.2.3-70-g09d2