Attempt to fix nil pointer dereference

This commit is contained in:
Jakob Lechner 2025-09-15 18:00:46 +02:00
parent f7110da643
commit 808564b940

View file

@ -397,7 +397,7 @@ func (c *Collector) Collect(ch chan<- prometheus.Metric) {
) )
} else { } else {
for port, phoneNumberCallLog := range callLog.Lines { for port, phoneNumberCallLog := range callLog.Lines {
if phoneNumberCallLog.Data == nil { if phoneNumberCallLog == nil || phoneNumberCallLog.Data == nil || phoneNumberCallLog.Data.Entries == nil {
continue continue
} }
for _, callLogEntry := range phoneNumberCallLog.Data.Entries { //port", "id", "external_number", "direction", "type for _, callLogEntry := range phoneNumberCallLog.Data.Entries { //port", "id", "external_number", "direction", "type