If no dives are selected, clear the stats widget

Previously we had lots of zeros and some non-sensical data displayed (the
temp values were actually not zeroed out).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-12-20 14:47:18 -10:00
parent 8bbe24f485
commit 75f6159a04

View file

@ -678,6 +678,10 @@ static void show_total_dive_stats(struct dive *dive)
get_selected_dives_text(buffer, sizeof(buffer));
set_label(stats_w.framelabel, "Statistics %s", buffer);
set_label(stats_w.selection_size, "%d", stats_ptr->selection_size);
if (stats_ptr->selection_size == 0) {
clear_stats_widgets();
return;
}
if (stats_ptr->min_temp) {
value = get_temp_units(stats_ptr->min_temp, &unit);
set_label(stats_w.min_temp, "%.1f %s", value, unit);