aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2016-05-24 17:19:59 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2016-05-24 17:19:59 +0100
commiteb3cebfcda16bfda4cfe261836d756e4699041aa (patch)
treee623cbd1b85e6c85a0fd7c28b70c2d653ac2e85d /perllib
parentf10acf678577e3e5a691c8385a5c67944cd1ca2f (diff)
Warnfix if belongs_to_body called with no string.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/DB/Result/User.pm5
1 files changed, 3 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm
index 6bce415a6..054be3644 100644
--- a/perllib/FixMyStreet/DB/Result/User.pm
+++ b/perllib/FixMyStreet/DB/Result/User.pm
@@ -201,10 +201,11 @@ sub belongs_to_body {
my $self = shift;
my $bodies = shift;
- my %bodies = map { $_ => 1 } split ',', $bodies;
+ return 0 unless $bodies && $self->from_body;
- return 1 if $self->from_body && $bodies{ $self->from_body->id };
+ my %bodies = map { $_ => 1 } split ',', $bodies;
+ return 1 if $bodies{ $self->from_body->id };
return 0;
}