aboutsummaryrefslogtreecommitdiffstats
path: root/devel
diff options
context:
space:
mode:
authoreik <eik@FreeBSD.org>2004-07-07 22:48:44 +0800
committereik <eik@FreeBSD.org>2004-07-07 22:48:44 +0800
commite776e42494a5814a191dc58ebbd737bf7fb59d20 (patch)
treea23e4510f64ed1d0fa4dbbcfe692e37efe8cf0c6 /devel
parentb25ded856ffe1f9ca292aaa545b98efaf603da8c (diff)
downloadfreebsd-ports-gnome-e776e42494a5814a191dc58ebbd737bf7fb59d20.tar.gz
freebsd-ports-gnome-e776e42494a5814a191dc58ebbd737bf7fb59d20.tar.zst
freebsd-ports-gnome-e776e42494a5814a191dc58ebbd737bf7fb59d20.zip
fix a warning when GeoIP can't find the country for a site
Diffstat (limited to 'devel')
-rw-r--r--devel/portmk/scripts/ranksites-geoip.pl23
1 files changed, 13 insertions, 10 deletions
diff --git a/devel/portmk/scripts/ranksites-geoip.pl b/devel/portmk/scripts/ranksites-geoip.pl
index 4631ff6038a3..0777c744982f 100644
--- a/devel/portmk/scripts/ranksites-geoip.pl
+++ b/devel/portmk/scripts/ranksites-geoip.pl
@@ -125,19 +125,22 @@ if (%newdistance && $hostcount > 1) {
foreach (keys %newdistance) {
my $dist;
my $cc = lc $gi->country_code_by_name($_);
- my ($lat_cc, $lon_cc) = getlatlon($cc)
- if defined $cc;
- # Find the deltas
- my $delta_lat = $lat_cc - $lat_home;
- my $delta_lon = $lon_cc - $lon_home;
+ if ($cc) {
+ my ($lat_cc, $lon_cc) = getlatlon($cc)
+ if defined $cc;
- # Find the Great Circle distance
- my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
- $dist = atan2(sqrt($temp),sqrt(1-$temp));
+ # Find the deltas
+ my $delta_lat = $lat_cc - $lat_home;
+ my $delta_lon = $lon_cc - $lon_home;
- $distance{$_} = [$dist, $expgood]
- if defined $dist;
+ # Find the Great Circle distance
+ my $temp = sin($delta_lat/2.0)**2 + cos($lat_home) * cos($lat_cc) * sin($delta_lon/2.0)**2;
+ $dist = atan2(sqrt($temp),sqrt(1-$temp));
+
+ $distance{$_} = [$dist, $expgood]
+ if defined $dist;
+ }
}
open RANKS, ">$rankfile";