From: Michael Meier Date: Thu, 4 Feb 2016 13:54:34 +0000 (+0100) Subject: fix runtime warnings X-Git-Url: http://git.rrze.uni-erlangen.de/gitweb/?a=commitdiff_plain;h=8c5b52e4e0355d230e0232096663dfc368b73912;p=osmrrze.git fix runtime warnings --- diff --git a/cgis/osm-map.pl b/cgis/osm-map.pl index b5157dc..f4d50f0 100755 --- a/cgis/osm-map.pl +++ b/cgis/osm-map.pl @@ -22,34 +22,35 @@ my $mlat = -999.0; my $zoom = -1; my $baselayer = undef; if (defined(param('lon'))) { - $lon = param('lon'); + $lon = param('lon') || ''; unless ($lon =~ m/^-{0,1}\d+\.\d+$/) { $lon = -999.0; } if (($lon < -180.0) || ($lon > 180.0)) { $lon = -999.0; } } if (defined(param('lat'))) { - $lat = param('lat'); + $lat = param('lat') || ''; unless ($lat =~ m/^-{0,1}\d+\.\d+$/) { $lat = -999.0; } if (($lat < -90.0) || ($lat > 90.0)) { $lat = -999.0; } } if (defined(param('mlon'))) { - $mlon = param('mlon'); + $mlon = param('mlon') || ''; unless ($mlon =~ m/^-{0,1}\d+\.\d+$/) { $mlon = -999.0; } if (($mlon < -180.0) || ($mlon > 180.0)) { $mlon = -999.0; } } if (defined(param('mlat'))) { - $mlat = param('mlat'); + $mlat = param('mlat') || ''; unless ($mlat =~ m/^-{0,1}\d+\.\d+$/) { $mlat = -999.0; } if (($mlat < -90.0) || ($mlat > 90.0)) { $mlat = -999.0; } } if (defined(param('zoom'))) { - $zoom = param('zoom'); + $zoom = param('zoom') || ''; unless ($zoom =~ m/^\d+$/) { $zoom = -1; } if (($zoom < 0) || ($zoom > 30)) { $lat = -1; } } if (defined(param('layers'))) { # Mapping for Openlayers Permalinks my @layerlist = ('osmde', 'osmorg', 'osmorglowzoom', 'luftbilderl'); - my $layers = param('layers'); + my $layers = param('layers') || ''; + $layers .= ' '; # Just append spaces so we do not get warnings if the string was too short. my $i; for ($i = 0; $i < int(@layerlist); $i++) { if (substr($layers, $i, 1) eq 'B') { # This is our baselayer @@ -59,7 +60,7 @@ if (defined(param('layers'))) { } if (defined(param('layer'))) { # Mapping for Leaflet Permalinks - my $layers = param('layer'); + my $layers = param('layer') || ''; if ($layers eq 'RRZE tileserver osm.de style tiles') { $baselayer = 'osmde'; } if ($layers eq 'RRZE tileserver osm.org style tiles') { $baselayer = 'osmorg'; } if ($layers eq 'RRZE tileserver osm.org style with different lowzoom tiles') { $baselayer = 'osmorglowzoom'; }