From 477bbe5b6229756f988ae360628f0994a9dd1326 Mon Sep 17 00:00:00 2001 From: Alex Godbehere <114239316+AlexGodbehere@users.noreply.github.com> Date: Fri, 8 Mar 2024 15:20:09 +0000 Subject: [PATCH] Fix conditional check when checking if bit specified (#65) Fixes a bug that was checking if a bit was specified not seeing 0 as false. --- lib/helpers/typeHandler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers/typeHandler.ts b/lib/helpers/typeHandler.ts index f95e621..622e765 100644 --- a/lib/helpers/typeHandler.ts +++ b/lib/helpers/typeHandler.ts @@ -595,7 +595,7 @@ export function parseValFromBuffer(type: sparkplugDataType, endianness: byteOrde switch (type) { case sparkplugDataType.boolean: - if (bit) { + if (bit != null) { return (!!(buf[byteAddr] & (1 << bit))); } else { return -1;