desktop: fix div-by-zero when selecting multiple invalid dives

Signed-off-by: Tim Segers <tsegers@pm.me>
This commit is contained in:
Tim Segers 2021-10-11 18:53:52 +02:00 committed by Lubomir I. Ivanov
parent f3a02d7049
commit b618d93241

View file

@ -75,7 +75,7 @@ void TabDiveStatistics::updateData()
stats_t stats_selection; stats_t stats_selection;
calculate_stats_selected(&stats_selection); calculate_stats_selected(&stats_selection);
clear(); clear();
if (amount_selected > 1) { if (amount_selected > 1 && stats_selection.selection_size >= 1) {
ui->depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true)); ui->depthLimits->setMaximum(get_depth_string(stats_selection.max_depth, true));
ui->depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, true)); ui->depthLimits->setMinimum(get_depth_string(stats_selection.min_depth, true));
ui->depthLimits->setAverage(get_depth_string(stats_selection.combined_max_depth.mm / stats_selection.selection_size, true)); ui->depthLimits->setAverage(get_depth_string(stats_selection.combined_max_depth.mm / stats_selection.selection_size, true));