Skip to content
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(core): do not crash for signal query that does not have any matches #54353

Closed
wants to merge 1 commit into from

Conversation

JoostK
Copy link
Member

@JoostK JoostK commented Feb 8, 2024

The newly introduced signal queries would error if no match exists, due to an invalid read within the query internals.

This commit addresses the crash by allowing there to be no matches.

The newly introduced signal queries would error if no match exists, due to an
invalid read within the query internals.

This commit addresses the crash by allowing there to be no matches.
@JoostK JoostK added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime core: queries target: rc This PR is targeted for the next release-candidate labels Feb 8, 2024
@ngbot ngbot bot added this to the Backlog milestone Feb 8, 2024
@JoostK JoostK marked this pull request as ready for review February 8, 2024 21:16
for (let i = 0; i < tQueryMatches.length; i += 2) {
const tQueryMatches = tQuery.matches;
const result: Array<T|null> = [];
for (let i = 0; tQueryMatches !== null && i < tQueryMatches.length; i += 2) {

Choose a reason for hiding this comment

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

nit: how about an early exit after checking for tQueryMatches !== null?

Copy link
Member Author

Choose a reason for hiding this comment

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

The empty array is assigned to lQuery.matches, so adjusting the control flow would get a bit awkward.

Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

LGTM, thnx @JoostK !

Left one nit commit, feel free to ignore.

@pkozlowski-opensource pkozlowski-opensource added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 8, 2024
@pkozlowski-opensource pkozlowski-opensource added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Feb 8, 2024
@pkozlowski-opensource
Copy link
Member

caretaker note: I don't think G3 failure is related

jessicajaniuk pushed a commit that referenced this pull request Feb 9, 2024
…es (#54353)

The newly introduced signal queries would error if no match exists, due to an
invalid read within the query internals.

This commit addresses the crash by allowing there to be no matches.

PR Close #54353
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit abf6371.

atscott pushed a commit to atscott/angular that referenced this pull request Feb 16, 2024
…es (angular#54353)

The newly introduced signal queries would error if no match exists, due to an
invalid read within the query internals.

This commit addresses the crash by allowing there to be no matches.

PR Close angular#54353
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime core: queries merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: rc This PR is targeted for the next release-candidate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants