From ebd92b657b63755ed535c45de26e9b5c0a1c2cbe Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 2 Mar 2016 10:15:46 +0100 Subject: index: Only call XML accessors if ->errstr isn't set --- index.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'index.pl') diff --git a/index.pl b/index.pl index 950e206..6ccab8d 100644 --- a/index.pl +++ b/index.pl @@ -131,11 +131,19 @@ sub get_results { full_routes => 0, ); } - $data = { - results => [ $status->results ], - errstr => $status->errstr, - }; - if ( $status->can('identified_data') ) { + if ( not $status->errstr ) { + $data = { + results => [ $status->results ], + errstr => undef, + }; + } + else { + $data = { + results => [], + errstr => $status->errstr, + }; + } + if ( $status->can('identified_data') and not $status->errstr ) { ( $data->{id_name}, $data->{id_stop} ) = $status->identified_data; } if ( $status->errstr and $status->can('name_candidates') ) { -- cgit v1.2.3