From f77eca3bf9bb9b853f25c05bbda6a179eef3e0c9 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Wed, 24 Feb 2010 08:20:37 +0000 Subject: [PATCH] Avoid crash when module required by autoload is not available git-svn-id: https://svn.fhem.de/fhem/trunk@575 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 9ed569dfb..b6fb9a062 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -159,7 +159,7 @@ my $nextat; # Time when next timer will be triggered. my $intAtCnt=0; my %duplicate; # Pool of received msg for multi-fhz/cul setups my $duplidx=0; # helper for the above pool -my $cvsid = '$Id: fhem.pl,v 1.101 2010-01-29 07:37:47 rudolfkoenig Exp $'; +my $cvsid = '$Id: fhem.pl,v 1.102 2010-02-24 08:20:37 rudolfkoenig Exp $'; my $namedef = "where is either:\n" . "- a single device name\n" . @@ -2109,7 +2109,6 @@ Dispatch($$$) } my @found; - my $last_module; foreach my $m (sort { $modules{$a}{ORDER} cmp $modules{$b}{ORDER} } grep {defined($modules{$_}{ORDER});}keys %modules) { next if($iohash->{Clients} !~ m/:$m:/); @@ -2120,7 +2119,6 @@ Dispatch($$$) no strict "refs"; @found = &{$modules{$m}{ParseFn}}($hash,$dmsg); use strict "refs"; - $last_module = $m; last if(int(@found)); } @@ -2134,10 +2132,13 @@ Dispatch($$$) if($attr{global}{autoload_undefined_devices}) { $mname = LoadModule($mname); - no strict "refs"; - @found = &{$modules{$mname}{ParseFn}}($hash,$dmsg); - use strict "refs"; - $last_module = $mname; + if($modules{$mname} && $modules{$mname}{ParseFn}) { + no strict "refs"; + @found = &{$modules{$mname}{ParseFn}}($hash,$dmsg); + use strict "refs"; + } else { + Log 0, "ERROR: Cannot autoload $mname"; + } } else { Log GetLogLevel($name,3),