From 559c049f90985d93b227d3611f83d6f7258b341a Mon Sep 17 00:00:00 2001 From: Nick Bruun Date: Mon, 23 Feb 2015 23:21:19 +0100 Subject: [PATCH] Initialize location coordinates to NaN before lookup. --- reader.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reader.go b/reader.go index b2615c0..3f8fa2a 100644 --- a/reader.go +++ b/reader.go @@ -5,6 +5,7 @@ package geoip2 import ( + "math" "net" "github.com/oschwald/maxminddb-golang" @@ -133,6 +134,8 @@ func FromBytes(bytes []byte) (*Reader, error) { // method generally should be used with the GeoIP2 or GeoLite2 City databases. func (r *Reader) City(ipAddress net.IP) (*City, error) { var city City + city.Location.Latitude = math.NaN() + city.Location.Longitude = math.NaN() err := r.mmdbReader.Lookup(ipAddress, &city) return &city, err }