Commit 8eb4240
fix: add null checks for getViewState in SurfaceMountingManager (#57283)
Summary:
Fix SurfaceMountingManager null handling for methods that can be invoked after a view has been deleted or is otherwise missing. sendAccessibilityEvent and setJSResponder now use getNullableViewState(...) and guard against missing ViewState before accessing .view, logging a soft exception and returning instead of crashing. Also removed the now-unused getViewState helper.
## Changelog:
[ANDROID][FIXED] Avoid crash in SurfaceMountingManager when sendAccessibilityEvent or setJSResponder is called for a missing or deleted view state.
Pull Request resolved: #57283
Test Plan: This is a safe check added to avoid crashing the application with reference to similiar checks added in other related methods.
Reviewed By: fabriziocucci
Differential Revision: D109834942
Pulled By: javache
fbshipit-source-id: 75d6e5e646f78efe9456aaacafd40b05362003d71 parent 8371983 commit 8eb4240
1 file changed
Lines changed: 22 additions & 13 deletions
File tree
- packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting
Lines changed: 22 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
763 | | - | |
| 763 | + | |
| 764 | + | |
764 | 765 | | |
765 | | - | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
766 | 773 | | |
767 | 774 | | |
768 | 775 | | |
| |||
1004 | 1011 | | |
1005 | 1012 | | |
1006 | 1013 | | |
1007 | | - | |
1008 | | - | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
1009 | 1027 | | |
1010 | 1028 | | |
1011 | 1029 | | |
1012 | 1030 | | |
1013 | 1031 | | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
1017 | 1032 | | |
1018 | 1033 | | |
1019 | 1034 | | |
| |||
1122 | 1137 | | |
1123 | 1138 | | |
1124 | 1139 | | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | 1140 | | |
1132 | 1141 | | |
1133 | 1142 | | |
| |||
0 commit comments