Guard against result of getUIManager(...) being null

Summary:
`getUIManagerX(...)` can return null now. Guard in a few places that use it or add comments.

Changelog: [Internal]

Reviewed By: alexeylang

Differential Revision: D18351197

fbshipit-source-id: f077835468a75d1af24cfb4210989ba875ff9086
This commit is contained in:
Joshua Gross 2019-11-06 12:09:38 -08:00 коммит произвёл Facebook Github Bot
Родитель 38b3cbcca9
Коммит b7c2d4389a
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -1080,6 +1080,10 @@ public class ReactInstanceManager {
private void attachRootViewToInstance(final ReactRoot reactRoot) { private void attachRootViewToInstance(final ReactRoot reactRoot) {
Log.d(ReactConstants.TAG, "ReactInstanceManager.attachRootViewToInstance()"); Log.d(ReactConstants.TAG, "ReactInstanceManager.attachRootViewToInstance()");
Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachRootViewToInstance"); Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachRootViewToInstance");
// UIManager is technically Nullable here, but if we can't get a UIManager
// at this point, something has probably gone horribly wrong so it's probably best
// to throw a NullPointerException.
UIManager uiManager = UIManager uiManager =
UIManagerHelper.getUIManager(mCurrentReactContext, reactRoot.getUIManagerType()); UIManagerHelper.getUIManager(mCurrentReactContext, reactRoot.getUIManagerType());