Merge pull request #7 from ginabythebay/master

Avoid nil dereference when LastMeasure is not available
This commit is contained in:
Nicolas Leclercq 2020-10-09 09:33:08 +02:00 committed by GitHub
commit a8620474d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)