-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix: Prevent crash in Document.prototype.init() with null/undefined #15812
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
base: master
Are you sure you want to change the base?
Fix: Prevent crash in Document.prototype.init() with null/undefined #15812
Conversation
|
@vkarpov15, Kindly please review the pull request. |
vkarpov15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo unrelated formatting changes, this PR is impossible to review
572480e to
fb6e075
Compare
|
@vkarpov15 Thanks for the feedback!. I've reverted the unrelated formatting changes and updated the PR to include only the fix and a regression test. Ready for review. |
d0d596b to
c08e538
Compare
c08e538 to
1bcab8d
Compare
|
Hello @vkarpov15, I have made all the necessary changes. Please take a moment to review them. |
vkarpov15
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please undo all the unrelated formatting changes
Fix: Prevent crash in
Document.prototype.init()when called with null/undefinedSummary
Calling
Document.prototype.init()withnullorundefinedcurrently throws a low-levelTypeError (
Cannot read properties of null (reading '_id')). This PR adds an explicitnull/undefined check and throws a proper
ObjectParameterErrorinstead.Motivation and Context
init()is part of the public API. While normally used internally, custom scripts or pluginsmay pass invalid input. The new error message improves developer experience and prevents an
unexpected crash.
Reproduction
Testing
npm testto ensure no regressions.Kindly please review the pull request and merge it.
Thank you!