From fbeef8ab4f4d19ae048a6460fcdc3c5782e2b132 Mon Sep 17 00:00:00 2001 From: Noel Cragg Date: Sun, 8 Jul 2018 06:12:15 +0000 Subject: fix invalid self-reference During the structure rebuild, the 'message' key is removed before its callback is invoked, causing 'this.message' to raise a nonexistent key error. This change reverts the line in question to its pre-84aad729 logic (but leaving the variable name substitutions in place). --- glucometerutils/support/lifescan_binary_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glucometerutils/support/lifescan_binary_protocol.py b/glucometerutils/support/lifescan_binary_protocol.py index 1771dcf..4632a94 100644 --- a/glucometerutils/support/lifescan_binary_protocol.py +++ b/glucometerutils/support/lifescan_binary_protocol.py @@ -44,7 +44,7 @@ def LifeScanPacket(command_prefix, include_link_control): 'link_control' / link_control_construct, 'command_prefix' / command_prefix_construct, 'message' / construct.Bytes( - lambda this: len(this.message)), + lambda this: this.length - 7), construct.Const(b'\x03'), # etx ), ), -- cgit v1.2.3