diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2026-01-03 09:41:56 +0100 |
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2026-01-03 09:41:56 +0100 |
| commit | 8424be70dafd69a719030be4a064e24cc5d2ccab (patch) | |
| tree | 696054be062952cd8f5bd5333fabf80c41177d32 | |
| parent | eb8fe93b143107f430e215eedfb4b724baba1494 (diff) | |
->{start_percent} (and, thus, ->duration) may be undef
| -rwxr-xr-x | bin/dbris-m | 4 | ||||
| -rw-r--r-- | lib/Travel/Status/DE/DBRIS/Formation.pm | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/bin/dbris-m b/bin/dbris-m index 698d668..527f421 100755 --- a/bin/dbris-m +++ b/bin/dbris-m @@ -601,7 +601,9 @@ if ($train_no) { if ( my $min_percentage = min @start_percentages ) { print ' ' x ( $min_percentage - 1 ); } - print $wr->direction == 100 ? '>' : '<'; + if ( defined $wr->direction ) { + print $wr->direction == 100 ? '>' : '<'; + } for my $wagon ( $wr->carriages ) { my $wagon_length = $wagon->length_percent; diff --git a/lib/Travel/Status/DE/DBRIS/Formation.pm b/lib/Travel/Status/DE/DBRIS/Formation.pm index 1929820..2027462 100644 --- a/lib/Travel/Status/DE/DBRIS/Formation.pm +++ b/lib/Travel/Status/DE/DBRIS/Formation.pm @@ -118,7 +118,9 @@ sub parse_carriages { $self->{train_numbers} = \@numbers; if ( @{ $self->{carriages} // [] } > 1 ) { - if ( $self->{carriages}[0]->{start_percent} + if ( defined $self->{carriages}[0]->{start_percent} + and defined $self->{carriages}[-1]->{start_percent} + and $self->{carriages}[0]->{start_percent} > $self->{carriages}[-1]->{start_percent} ) { $self->{direction} = 100; |
