Skip to content

Commit

Permalink
Journey: Deal with backends that do not provide a stopL (empty route)
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed Aug 16, 2024
1 parent be1be95 commit bc13102
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Travel/Status/DE/HAFAS/Journey.pm
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ sub new {
}
$ref->{is_additional} = $journey->{stbStop}{isAdd};
}
elsif ( $stops[0]{loc} ) {
elsif ( $stops[0] and $stops[0]{loc} ) {
$ref->{route_start} = $stops[0]{loc}->name;
}

Expand Down Expand Up @@ -307,7 +307,7 @@ sub polyline {
sub route {
my ($self) = @_;

if ( $self->{route} ) {
if ( $self->{route} and @{ $self->{route} } ) {
if ( $self->{route}[0] and $self->{route}[0]{stop} ) {
$self->{route}
= [ map { Travel::Status::DE::HAFAS::Stop->new( %{$_} ) }
Expand Down

0 comments on commit bc13102

Please sign in to comment.