diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-22 11:12:24 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-22 11:12:24 +0100 |
commit | ecaf7a2376e17a319a2b1ada92a32671e6503271 (patch) | |
tree | fc2b30c689168b5f03358c5e2116c11a31cd2090 | |
parent | c1b672c645db51656270ddd160119161483896f6 (diff) |
stopfinder: handle edge case with just a single result.
-rw-r--r-- | lib/Travel/Status/DE/EFA.pm | 9 |
1 files changed, 9 insertions, 0 deletions
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, |