Do not crash if weather output is too short

master
Elis Hirwing 2017-11-04 22:04:13 +01:00
parent a726e83ca6
commit 8f06b860fa
Signed by: etu
GPG Key ID: D57EFA625C9A925F
1 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,11 @@ func (weather *Weather) GetOutput() []string {
parts := strings.Split(weather.lastResponse, "\n")
return parts[:len(parts)-5]
if len(parts) > 6 {
return parts[:len(parts)-5]
}
return []string{}
}
func (weather *Weather) getWeather() (string, error) {