summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/dbris-m4
-rw-r--r--lib/Travel/Status/DE/DBRIS/Formation.pm4
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;