diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-05-24 17:19:59 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2016-05-24 17:19:59 +0100 |
commit | eb3cebfcda16bfda4cfe261836d756e4699041aa (patch) | |
tree | e623cbd1b85e6c85a0fd7c28b70c2d653ac2e85d /perllib/FixMyStreet/DB/Result/User.pm | |
parent | f10acf678577e3e5a691c8385a5c67944cd1ca2f (diff) |
Warnfix if belongs_to_body called with no string.
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 5 |
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; } |