mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix NullPointerException when reporting mounts for mount hooks (#39022)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39022 Fixes a possible NullPointerException thrown when trying to access the binding after the instance has been destroyed to report mounts. I added a check for the mount item just in case 😅 Changelog: [internal] Reviewed By: lenaic Differential Revision: D48355738 fbshipit-source-id: 401d2e0a52b0764ed89498ecc0176d160226e509
This commit is contained in:
committed by
Facebook GitHub Bot
parent
67f8d4014e
commit
0ba9808c88
+4
-3
@@ -1227,20 +1227,21 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
|
||||
public void run() {
|
||||
mMountNotificationScheduled.set(false);
|
||||
|
||||
if (mountItems == null) {
|
||||
final @Nullable Binding binding = mBinding;
|
||||
if (mountItems == null || binding == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Collect surface IDs for all the mount items
|
||||
List<Integer> surfaceIds = new ArrayList();
|
||||
for (MountItem mountItem : mountItems) {
|
||||
if (!surfaceIds.contains(mountItem.getSurfaceId())) {
|
||||
if (mountItem != null && !surfaceIds.contains(mountItem.getSurfaceId())) {
|
||||
surfaceIds.add(mountItem.getSurfaceId());
|
||||
}
|
||||
}
|
||||
|
||||
for (int surfaceId : surfaceIds) {
|
||||
mBinding.reportMount(surfaceId);
|
||||
binding.reportMount(surfaceId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user