From 2afc795e74ccf0df6adc385a06371839c525a9d1 Mon Sep 17 00:00:00 2001 From: Julian Kornberger Date: Thu, 14 Jul 2016 12:38:32 +0200 Subject: [PATCH] Fix possible nullpointer exception --- data/airtime.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/airtime.go b/data/airtime.go index b027ac1..f0212c4 100644 --- a/data/airtime.go +++ b/data/airtime.go @@ -27,8 +27,12 @@ type WirelessAirtime struct { // Calculates the utilization values in regard to the previous values func (cur *WirelessStatistics) SetUtilization(prev *WirelessStatistics) { - cur.Airtime24.SetUtilization(prev.Airtime24) - cur.Airtime5.SetUtilization(prev.Airtime5) + if cur.Airtime24 != nil { + cur.Airtime24.SetUtilization(prev.Airtime24) + } + if cur.Airtime5 != nil { + cur.Airtime5.SetUtilization(prev.Airtime5) + } } // Calculates the utilization values in regard to the previous values