]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/geoip-functions.pl
GeoIP: Do not crash when locations database does not exist
[ipfire-2.x.git] / config / cfgroot / geoip-functions.pl
index d03503a3f9ad0a2f8e38bdb2da660ecbdda43550..b2319daaaffe7168d04cfafeabb2113af92cd08a 100644 (file)
@@ -122,10 +122,10 @@ sub get_full_country_name($) {
 
 # Function to get all available GeoIP locations.
 sub get_geoip_locations() {
-       my @locations;
+       my @locations = ();
 
        # Open the location database.
-       open(LOCATION, "$geoip_database_dir/$location_database") or die "Could not open $geoip_database_dir/$location_database. $!\n";
+       open(LOCATION, "$geoip_database_dir/$location_database") or return @locations;
 
        # Loop through the file.
        while(my $line = <LOCATION>) {