aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm7
-rw-r--r--perllib/FixMyStreet/App/Controller/Location.pm4
2 files changed, 7 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index 9a754f063..492565bb9 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -40,9 +40,10 @@ sub around_index : Path : Args(0) {
my $partial_report = $c->forward('load_partial');
# Try to create a location for whatever we have
- return
- unless $c->forward('/location/determine_location_from_coords')
- || $c->forward('/location/determine_location_from_pc');
+ my $ret = $c->forward('/location/determine_location_from_coords')
+ || $c->forward('/location/determine_location_from_pc');
+ return unless $ret;
+ return $c->res->redirect('/') if $ret == -1;
# Check to see if the spot is covered by a area - if not show an error.
return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable');
diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm
index fd3fadd9f..f103ff7f9 100644
--- a/perllib/FixMyStreet/App/Controller/Location.pm
+++ b/perllib/FixMyStreet/App/Controller/Location.pm
@@ -50,6 +50,8 @@ sub determine_location_from_coords : Private {
User has searched for a location - try to find it for them.
+Return -1 if nothing provided.
+
If one match is found returns true and lat/lng is set.
If several possible matches are found puts an array onto stash so that user can be prompted to pick one and returns false.
@@ -62,7 +64,7 @@ sub determine_location_from_pc : Private {
my ( $self, $c, $pc ) = @_;
# check for something to search
- $pc ||= $c->req->param('pc') || return;
+ $pc ||= $c->req->param('pc') || return -1;
$c->stash->{pc} = $pc; # for template
if ( $pc =~ /^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/ ) {