Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been seeing the following error intermittently when running puppeteer-dart, which is causing test run failures.
I was able to recreate this scenario with the following code:
The issue appears to be related to the use of the null assertion operator (!) on a value that can in fact be null in this case. From what I can tell
nodeById
does not contain thechildId.value
in the map, thus resulting innull
being returned. This appears to indicate that the child node is missing? from the FullAXTree(removed during processing?) or we've been given a bad id. Let me know if the FullAXTree missing a node is cause for concern.My proposal is to explicitly check for null after retrieving the value, prior to adding it to the list of children. I also updated the
node._payload.childIds!
to prevent the nesting from getting any deeper.Overall it feels like the
null assertion operator !
should be used sparingly, as the analyzer simply shuts off, even if you didn't check for null first.@xvrh for your review