Mercurial > hg > egg-tcls
changeset 334:088bb2621595
weather: Do not attempt to access weather data through unset / invalid
min/max temp keys.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 Sep 2015 14:38:53 +0300 |
parents | 9cecab5a0862 |
children | e6473e7083aa |
files | weather.tcl |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/weather.tcl Thu Aug 27 13:04:13 2015 +0300 +++ b/weather.tcl Sat Sep 26 14:38:53 2015 +0300 @@ -223,9 +223,14 @@ } close $ufile - # Store min/max - set weather_data(w_min) $weather_data($wtemp_min_key) - set weather_data(w_max) $weather_data($wtemp_max_key) + # Store min/max + if {$wtemp_min_key != "" && $wtemp_max_key != ""} { + set weather_data(w_min) $weather_data($wtemp_min_key) + set weather_data(w_max) $weather_data($wtemp_max_key) + } else { + set weather_data(w_min) 0 + set weather_data(w_max) 0 + } } else { weather_log "Could not open data file: $uerrmsg" }