From 757c2cec42c7bad89af877431fc00ad38c215749 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 23 Nov 2019 07:17:24 +0100 Subject: Fix uninitialized value warnings --- lib/DBInfoscreen/Controller/Stationboard.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 5acd616..803185f 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -231,8 +231,11 @@ sub get_route_timestamps { for my $suggestion ( @{ $trainsearch->{suggestions} // [] } ) { # Drunken API, sail with care. Both date formats are used interchangeably - if ( $suggestion->{depDate} eq $date_yy - or $suggestion->{depDate} eq $date_yyyy ) + if ( + exists $suggestion->{depDate} + and ( $suggestion->{depDate} eq $date_yy + or $suggestion->{depDate} eq $date_yyyy ) + ) { # Train numbers are not unique, e.g. IC 149 refers both to the # InterCity service Amsterdam -> Berlin and to the InterCity service @@ -954,7 +957,9 @@ sub handle_request { # whereas HAFAS data has all stops -> merge HAFAS stops into IRIS # stops. This is a rare case, one point where it can be observed is # the TGV service at Frankfurt/Karlsruhe/Mannheim. - if ( my @hafas_stations = @{ $route_info->{stations} } ) { + if ( $route_info + and my @hafas_stations = @{ $route_info->{stations} } ) + { if ( my @iris_stations = @{ $departures[-1]{route_pre_diff} } ) { -- cgit v1.2.3