]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
Fix: Dying process with geoip_city plugin when IP is unknown by plugin.
authoreldy <>
Sat, 19 Mar 2005 20:30:23 +0000 (20:30 +0000)
committereldy <>
Sat, 19 Mar 2005 20:30:23 +0000 (20:30 +0000)
wwwroot/cgi-bin/plugins/geoip_city_maxmind.pm

index 5324056f93adc3b0efd1518d33a3ed84b0461a6d..b32df336cea280ecaa09533a92c7b0151a86fba8 100755 (executable)
@@ -4500,17 +4500,21 @@ sub SectionProcessIp_geoip_city_maxmind {
        my $record=();
        $record=$geoip_city_maxmind->record_by_addr($param) if $geoip_city_maxmind;
        if ($Debug) { debug("  Plugin geoip_city_maxmind: GetCityByIp for $param: [$record]",5); }
-    my $city=$record->city;
-#      if ($PageBool) { $_city_p{$city}++; }
-    if ($city) {
-        my $countrycity=($record->country_code).'_'.$city;
-        $countrycity=~s/ /%20/g;
-        if ($record->region) { $countrycity.='_'.$record->region; }
-        $_city_h{lc($countrycity)}++;
+    if ($record) {
+        my $city=$record->city;
+#      if ($PageBool) { $_city_p{$city}++; }
+        if ($city) {
+            my $countrycity=($record->country_code).'_'.$city;
+            $countrycity=~s/ /%20/g;
+            if ($record->region) { $countrycity.='_'.$record->region; }
+            $_city_h{lc($countrycity)}++;
+        } else {
+            $_city_h{'unknown'}++;
+        }
+#      if ($timerecord > $_city_l{$city}) { $_city_l{$city}=$timerecord; }
     } else {
         $_city_h{'unknown'}++;
     }
-#      if ($timerecord > $_city_l{$city}) { $_city_l{$city}=$timerecord; }
        # ----->
        return;
 }