mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Desktop: support no-cylinders in dive information tab
The tab was crashing if there were no cylinders because 1) per_cylinder_mean_depth() would access non-existing cylinders. 2) TabDiveInformation::updateProfile() would access a non-existing mean. Fix both of these crash conditions by checking whether the dive actually has cylinders. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
fd23c3d908
commit
6a1e2cd8c2
2 changed files with 4 additions and 1 deletions
|
@ -753,6 +753,9 @@ void per_cylinder_mean_depth(const struct dive *dive, struct divecomputer *dc, i
|
|||
bool *used_cylinders;
|
||||
int num_used_cylinders;
|
||||
|
||||
if (dive->cylinders.nr <= 0)
|
||||
return;
|
||||
|
||||
for (i = 0; i < dive->cylinders.nr; i++)
|
||||
mean[i] = duration[i] = 0;
|
||||
if (!dc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue