Skip to content

fix switch braces - #5

Closed
matevzv wants to merge 1 commit into
MaximBelov:masterfrom
matevzv:fix-braces
Closed

matevzv wants to merge 1 commit into
MaximBelov:masterfrom
matevzv:fix-braces

Conversation

@matevzv

@matevzv matevzv commented May 20, 2025

Copy link
Copy Markdown

There was an error happening sometimes when scanning. The code ended up in the wrong switch default:

default:
throw "19";

I fund the bug in the code with switch braces. I tested the fixed code and it seems to be working correctly now.

@Duskfen Duskfen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran into the same issue with version 1.0.7 - can confirm the fix works. Also noticed another missing break pattern.
@MaximBelov any chance you are merging this and releasing a new version?

Comment thread src/BarcodeParser.js
default:
throw "16";
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here is also a missing break;
Otherwise 4300-4333 throw with the same missing break pattern.

Suggested change
break;

@MaximBelov

Copy link
Copy Markdown
Owner

Shipped in 1.0.8. Your commit went in as-is via #6, with your authorship kept on the squash.

@Duskfen was right that the same pattern was left behind: the switch on the third digit of a 43xx identifier also closed without a break, so 4300-4333 threw after parsing correctly. That break is in too.

Parsing all 193 identifiers the library supports, 46 were broken on 1.0.7 — the whole 43xx block and 710-715 threw, 7010 came back relabelled as 7011, and 7020-7023/7040/7240-7242 returned ai: undefined. All 193 pass now, and there is a spec covering every one of them so this class of bug fails the build rather than shipping.

Thanks for tracking it down.

@MaximBelov MaximBelov closed this Aug 13, 2026
@Duskfen

Duskfen commented Aug 13, 2026

Copy link
Copy Markdown

Thanks @MaximBelov for looking into this, appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants