mirror of
https://github.com/steinhobelgruen/netatmo-api-go.git
synced 2024-11-24 07:13:55 +00:00
Merge pull request #7 from ginabythebay/master
Avoid nil dereference when LastMeasure is not available
This commit is contained in:
commit
a8620474d1
|
@ -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