diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-03-02 10:15:46 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-03-02 10:15:46 +0100 |
commit | ebd92b657b63755ed535c45de26e9b5c0a1c2cbe (patch) | |
tree | a65331217185e168017452dac150ea181f49bd45 | |
parent | 67259550d22aa174ffe58f0809f8fa0d173cc2ce (diff) |
index: Only call XML accessors if ->errstr isn't set
-rw-r--r-- | index.pl | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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') ) { |