aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2010-09-30 15:17:29 +0100
committerMatthew Somerville <matthew@mysociety.org>2010-09-30 15:17:29 +0100
commitc00fd45ce3b8cb41836a0b1bcb154dfa4036306a (patch)
tree57387a83c0ddebfb26b6973ee31a05a29986c3b8
parent741fc60a9dea5edb79dcbfec031ee79634bab7f2 (diff)
Deal with bad ONS code.
-rwxr-xr-xweb/reports.cgi4
1 files changed, 4 insertions, 0 deletions
diff --git a/web/reports.cgi b/web/reports.cgi
index 04233fbee..bc418db7c 100755
--- a/web/reports.cgi
+++ b/web/reports.cgi
@@ -34,6 +34,10 @@ sub main {
my ($one_council, $area_type, $area_name);
if ($q_council =~ /^(\d\d)([a-z]{2})?([a-z]{2})?$/i) {
my $va_info = mySociety::MaPit::call('area', uc $q_council);
+ if ($va_info->{error}) { # Given a bad/old ONS code
+ print $q->redirect($base_url . '/reports');
+ return;
+ }
$area_name = Page::short_name($va_info->{name});
if (length($q_council) == 6) {
$va_info = mySociety::MaPit::call('area', $va_info->{parent_area});