-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Add check for existing array before reading #2042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add check for existing array before reading #2042
Conversation
When parsing a proto and handling oneofs there is no check if the array actually exists before reading it, causing the code to throw errors some times. This change add a check if the oneoffsArray exist before trying to read it.
@sofisl Is this something you could help get merged and released? I found this open PR after we started running into this error as well, but I'm not sure who exactly to ping.
It seems to be much more likely to hit the indexOf
error when using @grpc/proto-loader
since that library uses the toDescriptor
methods.
I added a minimal repro of the issue to #1958. I'm happy to add a regression test as well if it will help this get merged and released. Thanks!
@dcodeIO Is this something you could help get merged and released? Or who would be the best maintainer to take a look? Thanks!
abobr
commented
Jul 8, 2025
would be nice to have this merged. we use an npm hook in order to manually fix package after installation
When parsing a proto and handling oneofs there is no check if the array actually exists before reading it, causing the code to throw errors some times.
This change add a check if the oneoffsArray exist before trying to read it.
Seems to be the samme issue as described in: #1958