MAX: more robustness checks

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@7068 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
mgehre
2014-11-26 19:50:04 +00:00
parent 805339f9d3
commit b0693aa2b5

View File

@@ -596,10 +596,8 @@ MAX_Parse($$)
return () if($MAX ne "MAX"); return () if($MAX ne "MAX");
Log3 $hash, 5, "MAX_Parse $msg"; Log3 $hash, 5, "MAX_Parse $msg";
#Find the device with the given addr
my $shash = $modules{MAX}{defptr}{$addr};
if(!$shash) if(!exists($modules{MAX}{defptr}{$addr}))
{ {
my $devicetype = undef; my $devicetype = undef;
$devicetype = $args[0] if($msgtype eq "define" and $args[0] ne "Cube"); $devicetype = $args[0] if($msgtype eq "define" and $args[0] ne "Cube");
@@ -614,6 +612,8 @@ MAX_Parse($$)
} }
} }
my $shash = $modules{MAX}{defptr}{$addr};
#if $isToMe is true, then the message was directed at device $hash, thus we can also use it for sending #if $isToMe is true, then the message was directed at device $hash, thus we can also use it for sending
if($isToMe) { if($isToMe) {
$shash->{IODev} = $hash; $shash->{IODev} = $hash;