From be8a4f3bcac4868627562aca6d7d711bad09396e Mon Sep 17 00:00:00 2001 From: Ryan D McGuire Date: Sun, 5 Jan 2025 17:36:39 -0500 Subject: [PATCH] Don't enrich nil updates --- pkg/weather/enrich.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/weather/enrich.go b/pkg/weather/enrich.go index f86f3fa..5a3d2f7 100644 --- a/pkg/weather/enrich.go +++ b/pkg/weather/enrich.go @@ -5,6 +5,10 @@ import "math" // Attempts to complete missing fields that may not // be set by a specific provider, such as DewPoint and WindChill func (u *WeatherUpdate) Enrich() { + if u == nil { + return + } + if u.WindChillF == 0 { u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH) }