Log SoftError when there is not EventDispatcher associated to UIManager

Summary:
This diff logs a SoftError when there is not EventDispatcher associated to UIManager

The app will crash in Debug mode, this will not affect production users
changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D25859546

fbshipit-source-id: 8045bcd67f613ea6286f30fe6f3c66113c700b0b
This commit is contained in:
David Vacca
2021-01-10 19:44:28 -08:00
committed by Facebook GitHub Bot
parent 4076293aa1
commit 5803c72982
@@ -111,7 +111,17 @@ public class UIManagerHelper {
return ((EventDispatcherProvider) context).getEventDispatcher();
}
UIManager uiManager = getUIManager(context, uiManagerType, false);
return uiManager == null ? null : (EventDispatcher) uiManager.getEventDispatcher();
if (uiManager == null) {
return null;
}
EventDispatcher eventDispatcher = (EventDispatcher) uiManager.getEventDispatcher();
if (eventDispatcher == null) {
ReactSoftException.logSoftException(
"UIManagerHelper",
new IllegalStateException(
"Cannot get EventDispatcher for UIManagerType " + uiManagerType));
}
return eventDispatcher;
}
/**