diff options
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm index 59046f2..a73bcc4 100644 --- a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm +++ b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm @@ -99,7 +99,9 @@ sub new { = ( $pos->{start} - $platform->{start} ) * 100 / $platform_length, $ref->{end_percent} = ( $pos->{end} - $platform->{start} ) * 100 / $platform_length, - $ref->{length_meters} = $pos->{start} - $pos->{end}; + if ( defined $pos->{start} and defined $pos->{end} ) { + $ref->{length_meters} = $pos->{start} - $pos->{end}; + } $ref->{length_percent} = $ref->{end_percent} - $ref->{start_percent}; if ( $pos->{start} eq '' |