-
Notifications
You must be signed in to change notification settings - Fork 121
Fix NPE in IdenticalExpressionsDiagnostic when ctx.children is null #3679
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 NPE in IdenticalExpressionsDiagnostic when ctx.children is null #3679
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: nixel2007 <[email protected]>
...ava/com/github/_1c_syntax/bsl/languageserver/diagnostics/IdenticalExpressionsDiagnostic.java
Outdated
Show resolved
Hide resolved
Co-authored-by: nixel2007 <[email protected]>
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.
Pull request overview
This PR fixes a NullPointerException in IdenticalExpressionsDiagnostic that occurs when ctx.children is null. The fix replaces direct field access (ctx.children.size()) with the ANTLR-provided method (ctx.getChildCount()), which handles null cases properly.
Key Changes
- Modified the
sufficientSize()method to usegetChildCount()instead of direct field access - The change prevents NPE when processing expressions with null children
ctx.childrenis null insufficientSizemethodgetChildCount()method instead of direct field access (per reviewer suggestion)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.