diff options
Diffstat (limited to 'lib/Travel/Status/DE/IRIS/Result.pm')
-rw-r--r-- | lib/Travel/Status/DE/IRIS/Result.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 847682f..5a4247c 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -202,8 +202,8 @@ sub new { $ref->{is_cancelled} = 0; - if ( not defined $ref->{line_no} ) { - my $train_prefix = substr( $ref->{train_no}, 0, 3 ); + if ( not defined $ref->{line_no} and length( $ref->{train_no} ) > 2 ) { + my $train_prefix = substr( $ref->{train_no}, -5, 3 ); $ref->{line_no} = $linemap{ $ref->{type} }{$train_prefix}; } |