From 3d1d7be6ca5b898202f2c7bc83f65ec346124dda Mon Sep 17 00:00:00 2001 From: ntruchsess Date: Fri, 3 May 2013 21:15:31 +0000 Subject: [PATCH] Fix race-condition in FRM_Poll if connection is unstable git-svn-id: https://svn.fhem.de/fhem/trunk@3150 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/10_FRM.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fhem/FHEM/10_FRM.pm b/fhem/FHEM/10_FRM.pm index ec1a47813..082e0135f 100755 --- a/fhem/FHEM/10_FRM.pm +++ b/fhem/FHEM/10_FRM.pm @@ -461,7 +461,7 @@ sub FRM_poll vec($rin, $hash->{FD}, 1) = 1; my $nfound = select($rout=$rin, undef, undef, 0.1); my $mfound = vec($rout, $hash->{FD}, 1); - if($mfound) { + if($mfound && defined $hash->{FirmataDevice}) { $hash->{FirmataDevice}->poll(); } return $mfound; @@ -472,7 +472,7 @@ sub FRM_poll if($po) { ($BlockingFlags, $InBytes, $OutBytes, $ErrorFlags) = $po->status; } - if ($InBytes && $InBytes>0) { + if ($InBytes && $InBytes>0 && defined $hash->{FirmataDevice}) { $hash->{FirmataDevice}->poll(); } }