-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix array == null error in AccessibilityBridge #35540
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2695,6 +2695,12 @@ private void updateRecursively( | |
| if (globalTransform == null) { | ||
| globalTransform = new float[16]; | ||
| } | ||
| if (transform == null) { | ||
| if (BuildConfig.DEBUG) { | ||
| throw new AssertionError("transform has not been initialized"); | ||
| } | ||
| transform = new float[16]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this and the thing above be initialized to an identity transformation?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @Hixie who may have context as the author of the original null check that initialized all matrix elements to zero.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better than crash
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hope merge, plz
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be initialized during the SemanticsNode.updateWith. The only possible case I can think of is the framework sent a semantics node with child that is not in the update list. This feels like a bug in the framework side. Do you have a reproducible code? |
||
| } | ||
| Matrix.multiplyMM(globalTransform, 0, ancestorTransform, 0, transform, 0); | ||
|
|
||
| final float[] sample = new float[4]; | ||
|
|
||
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.
I imagine you still need another condition to initialize it so it won't crash in release code.
I did try to compile a custom engine in release mode, but it looks like the assertion will still crash the app. @GaryQian Do you know if the assertionError will be ignored in release mode?
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.
You meant the exception will be thrown only on debug mode, right? Shall BuildConfig.DEBUG work?
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.
yeah I think BuildConfig.DEBUG is probably the best way to do this
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.
will reedit it.