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 коммит произвёл Facebook GitHub Bot
Родитель 4076293aa1
Коммит 5803c72982
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -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;
}
/**