From b7c2d4389a11bbc144fcd3273f1c2517123c0911 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 6 Nov 2019 12:09:38 -0800 Subject: [PATCH] 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 --- .../main/java/com/facebook/react/ReactInstanceManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index ef0648525da..6485e49cf02 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -1080,6 +1080,10 @@ public class ReactInstanceManager { private void attachRootViewToInstance(final ReactRoot reactRoot) { Log.d(ReactConstants.TAG, "ReactInstanceManager.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 = UIManagerHelper.getUIManager(mCurrentReactContext, reactRoot.getUIManagerType());