Don't enrich nil updates
This commit is contained in:
parent
96dfcf7e53
commit
be8a4f3bca
@ -5,6 +5,10 @@ import "math"
|
|||||||
// Attempts to complete missing fields that may not
|
// Attempts to complete missing fields that may not
|
||||||
// be set by a specific provider, such as DewPoint and WindChill
|
// be set by a specific provider, such as DewPoint and WindChill
|
||||||
func (u *WeatherUpdate) Enrich() {
|
func (u *WeatherUpdate) Enrich() {
|
||||||
|
if u == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if u.WindChillF == 0 {
|
if u.WindChillF == 0 {
|
||||||
u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH)
|
u.WindChillF = CalculateWindChill(u.TempOutdoorF, u.WindSpeedMPH)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user