summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-03-02 10:15:46 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-03-02 10:15:46 +0100
commitebd92b657b63755ed535c45de26e9b5c0a1c2cbe (patch)
treea65331217185e168017452dac150ea181f49bd45
parent67259550d22aa174ffe58f0809f8fa0d173cc2ce (diff)
index: Only call XML accessors if ->errstr isn't set
-rw-r--r--index.pl18
1 files changed, 13 insertions, 5 deletions
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') ) {