Fix NullPointerException when disaptching events

Summary:
This diff fixes a NullPointerException when disaptching events while the SurfaceMountingManager is being destroyed

changelog: [android] android

Reviewed By: cortinico

Differential Revision: D35559550

fbshipit-source-id: c07f74493384fb1b306338ec1bc8b96f1b6f1f41
This commit is contained in:
David Vacca
2022-04-12 12:18:14 -07:00
committed by Facebook GitHub Bot
parent 52d8a797e7
commit fbeb51ef51
@@ -1026,13 +1026,14 @@ public class SurfaceMountingManager {
}
private @Nullable ViewState getNullableViewState(int tag) {
if (mTagToViewState == null) {
ConcurrentHashMap<Integer, ViewState> viewStates = mTagToViewState;
if (viewStates == null) {
return null;
}
if (ReactFeatureFlags.enableDelayedViewStateDeletion) {
mScheduledForDeletionViewStateTags.remove(tag);
}
return mTagToViewState.get(tag);
return viewStates.get(tag);
}
@SuppressWarnings("unchecked") // prevents unchecked conversion warn of the <ViewGroup> type