From e2de80f6bb6e929a8f9a9fb73223c1cd8966db9c Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 21 Dec 2025 20:01:53 +0100 Subject: Carriage: handle undefined vehicleID --- lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm index f4f602d..acc621c 100644 --- a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm +++ b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm @@ -49,7 +49,10 @@ sub new { $ref->{section} = $json{platformPosition}{sector}; $ref->{type} = $json{type}{constructionType}; - $ref->{model} =~ s{^.....(...)....(?:-.)?$}{$1} or $ref->{model} = undef; + if ( defined $ref->{model} ) { + $ref->{model} =~ s{^.....(...)....(?:-.)?$}{$1} + or $ref->{model} = undef; + } my $self = bless( $ref, $obj ); -- cgit v1.2.3