diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-03-18 16:02:49 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-03-18 16:02:49 +0000 |
commit | ea4513150fb9bf61150aa12aa3e1ea5644f3653e (patch) | |
tree | 5ab555b973b09fbcb6cc47ae711b588861660703 /perllib/Open311 | |
parent | ac4c85c701bd76c57c771b569a1f73743646a01a (diff) |
Check for only one result, fixes #359.
Diffstat (limited to 'perllib/Open311')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index 57ef90ecb..7990abfbf 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -72,7 +72,10 @@ sub process_services { my $list = shift; $self->found_contacts( [] ); - foreach my $service ( @{ $list->{service} } ) { + my $services = $list->{service}; + # XML might only have one result and then squashed the 'array'-ness + $services = [ $services ] unless ref $services eq 'ARRAY'; + foreach my $service ( @$services ) { $self->_current_service( $service ); $self->process_service; } |