Avoid nil dereference when LastMeasure is not available

This commit is contained in:
Gina White 2020-10-07 14:49:11 -07:00
parent 41589231f4
commit 1f48884138

View file

@ -63,6 +63,10 @@ func main() {
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()
for dataName, value := range data {
fmt.Printf("\t\t%s : %v (updated %ds ago)\n", dataName, value, ct-ts)