Merge branch 'master' of mjesec.ffzg.hr:/git/air-quality
[air-quality] / mh-z19b.pl
index c925661..0c3fbd1 100755 (executable)
@@ -29,7 +29,10 @@ while (1) {
        die $! if ! defined($len);
        if ( $len > 0 ) {
                my @v = unpack('C*', $string);
-               #warn "# $len ",dump($string), dump( @v ), $/;
+               if ( $#v < 8 ) {
+                       warn "# $len ",dump($string), dump( @v ), $/;
+                       next;
+               }
 
                my $sum = 0;
                foreach my $i ( 1 .. $#v - 1 ) {