summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS/Result.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-10-04 23:12:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2019-10-04 23:12:47 +0200
commit947e684bc1e4decc4661e288cacea967fe239c3b (patch)
treee90e3b2d6215fcc035dcd160c3aae920ecf80cb7 /lib/Travel/Status/DE/IRIS/Result.pm
parent3bad081cbd7f999e56d0d6a2edf4b008b030685e (diff)
Fix wrong route_pre / route_post when all prev/next stops are cancelled
Diffstat (limited to 'lib/Travel/Status/DE/IRIS/Result.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm14
1 files 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};