00_LIRC.pm: do not crash fhem if there is no /etc/lirc (Forum #95324)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18140 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-01-05 11:24:19 +00:00
parent 6acc98b8fa
commit 62fb301794

View File

@ -43,13 +43,17 @@ LIRC_Define($$)
my $config = $a[2];
Log3 $name, 3, "LIRC opening $name device $config";
my $lirc = Lirc::Client->new({
my $lirc;
eval {
$lirc = Lirc::Client->new({
prog => 'fhem',
rcfile => "$config",
debug => 0,
fake => 0,
});
return "Can't open $config: $!\n" if(!$lirc);
};
return "Error initializing Lirc::Client: $@" if($@);
return "Can't open $config: $!" if(!$lirc);
Log3 $name, 3, "LIRC opened $name device $config";
my $select = IO::Select->new();