From c35a4d56d561920def33005b775e3544ad830013 Mon Sep 17 00:00:00 2001
From: Michalis Pappas <mpappas@fastmail.fm>
Date: Sat, 26 Jan 2019 22:28:04 +0100
Subject: atsha204a: Only call output_tx_bytes() when the bytes buffer is not
 empty

---
 decoders/atsha204a/pd.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'decoders/atsha204a')

diff --git a/decoders/atsha204a/pd.py b/decoders/atsha204a/pd.py
index d149c49..8e37e5b 100644
--- a/decoders/atsha204a/pd.py
+++ b/decoders/atsha204a/pd.py
@@ -287,7 +287,6 @@ class Decoder(srd.Decoder):
 
     def decode(self, ss, es, data):
         cmd, databyte = data
-
         # State machine.
         if self.state == 'IDLE':
             # Wait for an I²C START condition.
@@ -309,7 +308,8 @@ class Decoder(srd.Decoder):
                 # Reset the opcode before received data, as this causes
                 # responses to be displayed incorrectly.
                 self.opcode = -1
-                self.output_rx_bytes()
+                if len(self.bytes) > 0:
+                        self.output_rx_bytes()
                 self.waddr = -1
                 self.bytes = []
                 self.state = 'IDLE'
-- 
cgit v1.2.3-70-g09d2