diff options
author | Daniel Friesel <derf@finalrewind.org> | 2019-11-23 07:17:24 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2019-11-23 07:17:24 +0100 |
commit | 757c2cec42c7bad89af877431fc00ad38c215749 (patch) | |
tree | 9bbb06847318677749cd40e7bf3f0634d3c6a041 | |
parent | aff13ed2dac8186b5d3890f02657f6ba08ff453c (diff) |
Fix uninitialized value warnings
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 11 |
1 files changed, 8 insertions, 3 deletions
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} } ) { |