From a7b8e7516be325265dce7300b17359d15a1715e0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 14 Jun 2022 22:24:50 +0200 Subject: correctly initialize ice_type_map hash This ensures proper operation when the zugbildungsplan is empty, e.g. because the underlying source file has become invalid. Closes #14 --- lib/DBInfoscreen.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 7730f90..53944fd 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -94,7 +94,7 @@ sub startup { if ( -r 'share/zugbildungsplan.json' ) { my $ice_type_map = JSON->new->utf8->decode( scalar read_file('share/zugbildungsplan.json') ); - my $ret; + my $ret = {}; while ( my ( $k, $v ) = each %{ $ice_type_map->{train} } ) { if ( $v->{type} ) { $ret->{$k} = [ -- cgit v1.2.3