Skip to content

Commit

Permalink
Fix NPE on RN-Tester due to null mFabricViewStateManager (#33910)
Browse files Browse the repository at this point in the history
Summary:
RN-Tester is currently crashing at startup time due to an NPE.
This PR fixes it.

## Changelog

[Android] [Fixed] - Fix NPE on `ReactEditText` due to null mFabricViewStateManager

Pull Request resolved: #33910

Test Plan: Tested locally that RN Tester runs both in Debug and in Release

Reviewed By: cipolleschi

Differential Revision: D36666440

Pulled By: cortinico

fbshipit-source-id: f004ff228fb4f9ff339aac606858d47de3706426
  • Loading branch information
cortinico authored and facebook-github-bot committed May 25, 2022
1 parent d315e9c commit ba6bf5a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,10 @@ private void setIntrinsicContentSize() {
// view, we don't need to construct one or apply it at all - it provides no use in Fabric.
ReactContext reactContext = getReactContext(this);

if (!mFabricViewStateManager.hasStateWrapper() && !reactContext.isBridgeless()) {
if (mFabricViewStateManager != null
&& !mFabricViewStateManager.hasStateWrapper()
&& !reactContext.isBridgeless()) {

final ReactTextInputLocalData localData = new ReactTextInputLocalData(this);
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
if (uiManager != null) {
Expand Down Expand Up @@ -983,7 +986,7 @@ public FabricViewStateManager getFabricViewStateManager() {
*/
private void updateCachedSpannable(boolean resetStyles) {
// Noops in non-Fabric
if (!mFabricViewStateManager.hasStateWrapper()) {
if (mFabricViewStateManager == null || !mFabricViewStateManager.hasStateWrapper()) {
return;
}
// If this view doesn't have an ID yet, we don't have a cache key, so bail here
Expand Down

0 comments on commit ba6bf5a

Please sign in to comment.