From ecaf7a2376e17a319a2b1ada92a32671e6503271 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 22 Dec 2024 11:12:24 +0100 Subject: stopfinder: handle edge case with just a single result. --- lib/Travel/Status/DE/EFA.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Travel/Status') diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm index e91cece..f6f4151 100644 --- a/lib/Travel/Status/DE/EFA.pm +++ b/lib/Travel/Status/DE/EFA.pm @@ -572,6 +572,15 @@ sub results_stopfinder { my $json = $self->{response}; my @results; + + # Edge case: there is just a single result. + # Oh EFA, you so silly. + if ( ref( $json->{stopFinder}{points} ) eq 'HASH' + and exists $json->{stopFinder}{points}{point} ) + { + $json->{stopFinder}{points} = [ $json->{stopFinder}{points}{point} ]; + } + for my $stop ( @{ $json->{stopFinder}{points} // [] } ) { push( @results, -- cgit v1.2.3