From eb3cebfcda16bfda4cfe261836d756e4699041aa Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 24 May 2016 17:19:59 +0100 Subject: Warnfix if belongs_to_body called with no string. --- perllib/FixMyStreet/DB/Result/User.pm | 5 +++-- 1 file 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; } -- cgit v1.2.3