Fix possible nullpointer exception

This commit is contained in:
Julian Kornberger 2016-07-14 12:38:32 +02:00
parent c30d6bc281
commit 2afc795e74

View File

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