mirror of
https://github.com/steinhobelgruen/netatmo-api-go.git
synced 2024-11-22 06:23:56 +00:00
Avoid nil dereference when LastMeasure is not available
This commit is contained in:
parent
41589231f4
commit
1f48884138
|
@ -63,6 +63,10 @@ func main() {
|
||||||
fmt.Printf("\tModule : %s\n", module.ModuleName)
|
fmt.Printf("\tModule : %s\n", module.ModuleName)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
if module.DashboardData.LastMeasure == nil {
|
||||||
|
fmt.Printf("\t\tSkipping %s, no measurement data available.\n", module.ModuleName)
|
||||||
|
continue
|
||||||
|
}
|
||||||
ts, data := module.Info()
|
ts, data := module.Info()
|
||||||
for dataName, value := range data {
|
for dataName, value := range data {
|
||||||
fmt.Printf("\t\t%s : %v (updated %ds ago)\n", dataName, value, ct-ts)
|
fmt.Printf("\t\t%s : %v (updated %ds ago)\n", dataName, value, ct-ts)
|
||||||
|
|
Loading…
Reference in a new issue