Skip to content

Commit

Permalink
Fix crashing bug when targeting to regions and city database returns nil
Browse files Browse the repository at this point in the history
  • Loading branch information
abh committed Oct 3, 2013
1 parent b625aa6 commit 0c23ff7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ func (g *GeoIP) GetCountryRegion(ip net.IP) (country, continent, regionGroup, re
}

record := geoIP.city.GetRecord(ip.String())
if record == nil {
return
}

country = record.CountryCode
region = record.Region
Expand Down

0 comments on commit 0c23ff7

Please sign in to comment.