Don't crash QP when GeoIP data is missing

This commit is contained in:
Jared Johnson 2015-02-26 17:04:49 -06:00
parent 573f7c5bf4
commit 15210db779

View File

@ -327,8 +327,11 @@ sub open_geoip_db {
# can't think of a good reason to load country if city data is present
if (!$self->{_geoip_city}) {
$self->log(LOGDEBUG, "using default db");
$self->{_geoip} = Geo::IP->new(); # loads default Country DB
warn "Missing GeoIP Country data!\n" if ! $self->{_geoip};
eval { $self->{_geoip} = Geo::IP->new(); }; # loads default Country DB
if (!$self->{_geoip}) {
my $err = $@ || 'Unknown error';
warn "Missing GeoIP Country data:$err\n";
}
}
}