Skip to content

Commit

Permalink
fix: Do not crash in away example if away config has no settings
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzolino committed Apr 13, 2022
1 parent 6816119 commit 4d393d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/away/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ func main() {
fmt.Println("Away Configuration:")
if awayConfig.AutoAdjust {
fmt.Printf("Comfort Level: %d\n", awayConfig.ComfortLevel)
fmt.Printf("Temperature: %.2f C°, %.2f F°\n", awayConfig.Setting.Temperature.Celsius, awayConfig.Setting.Temperature.Fahrenheit)

if awayConfig.Setting != nil {
fmt.Printf("Temperature: %.2f C°, %.2f F°\n", awayConfig.Setting.Temperature.Celsius, awayConfig.Setting.Temperature.Fahrenheit)
}
}

// Update comfort level
Expand Down

0 comments on commit 4d393d3

Please sign in to comment.