From 947e684bc1e4decc4661e288cacea967fe239c3b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 4 Oct 2019 23:12:47 +0200 Subject: Fix wrong route_pre / route_post when all prev/next stops are cancelled --- lib/Travel/Status/DE/IRIS/Result.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 156b8aa..17692ce 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -283,9 +283,11 @@ sub set_ar { $self->{platform} = $self->{sched_platform}; } - if ( $attrib{route_pre} ) { - $self->{route_pre} = [ split( qr{[|]}, $attrib{route_pre} // q{} ) ]; - $self->{route_start} = $self->{route_pre}[0]; + if ( defined $attrib{route_pre} ) { + $self->{route_pre} = [ split( qr{[|]}, $attrib{route_pre} // q{} ) ]; + if ( @{ $self->{route_pre} } ) { + $self->{route_start} = $self->{route_pre}[0]; + } } else { $self->{route_pre} = $self->{sched_route_pre}; @@ -344,9 +346,11 @@ sub set_dp { $self->{platform} = $self->{sched_platform}; } - if ( $attrib{route_post} ) { + if ( defined $attrib{route_post} ) { $self->{route_post} = [ split( qr{[|]}, $attrib{route_post} // q{} ) ]; - $self->{route_end} = $self->{route_post}[-1]; + if ( @{ $self->{route_post} } ) { + $self->{route_end} = $self->{route_post}[-1]; + } } else { $self->{route_post} = $self->{sched_route_post}; -- cgit v1.2.3