Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Fix conditional check when checking if bit specified (#65)
Browse files Browse the repository at this point in the history
Fixes a bug that was checking if a bit was specified not seeing 0 as
false.
  • Loading branch information
AlexGodbehere authored Mar 8, 2024
1 parent ed6ece3 commit 477bbe5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/helpers/typeHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 477bbe5

Please sign in to comment.