Skip to content

Commit d561361

Browse files
author
alexanderd
committed
message callback handles first element correctly (refs #7598)
git-svn-id: http://isvn/svn/rep_IEP-I000261_LINUX-KERNEL/01_Entwicklung/trunk/10_Entwicklung/28_SW_Komponente_XCOM/30_IMPL/XCOM_Client_Python/dependencies/ixcom-public@12244 fa3a88b2-825e-5648-bb98-bb0d4e3c2968
1 parent cd841cb commit d561361

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ixcom/grep.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ def read_file(filename='iXCOMstream.bin'):
5050
message_searcher = MessageSearcher(disable_crc = True)
5151

5252
def message_callback(in_bytes):
53+
if not in_bytes:
54+
return
5355
message_id = int(in_bytes[1])
54-
try:
55-
message_bytes_dict[message_id].write(in_bytes)
56-
except:
57-
message_bytes_dict[message_id] = io.BytesIO(in_bytes)
58-
message_bytes_dict[message_id].write(in_bytes) # initial bytes werden von write ueberschrieben
56+
if message_id not in message_bytes_dict:
57+
message_bytes_dict[message_id] = io.BytesIO(b'')
58+
message_bytes_dict[message_id].write(in_bytes)
5959

6060
config = {}
6161
def parameter_callback(msg, from_device):

0 commit comments

Comments
 (0)