Permalink
Browse files

Fix crash when resolveView fails to find a view

Reviewed By: yungsters

Differential Revision: D3997107

fbshipit-source-id: 7bf03ff06a6b56d192bab7fa567a11a38148f076
  • Loading branch information...
1 parent a3551b0 commit 8e91843cc7da4a791e5fe78078998f1c30592863 Andrew Y. Chen committed with Facebook Github Bot Oct 10, 2016
@@ -10,6 +10,7 @@
package com.facebook.react.uimanager;
import android.content.res.Resources;
+import android.util.Log;
import android.util.SparseArray;
import android.util.SparseBooleanArray;
import android.view.Menu;
@@ -64,6 +65,8 @@
@NotThreadSafe
public class NativeViewHierarchyManager {
+ private static final String TAG = NativeViewHierarchyManager.class.getSimpleName();
+
private final AnimationRegistry mAnimationRegistry;
private final SparseArray<View> mTagsToViews;
private final SparseArray<ViewManager> mTagsToViewManagers;
@@ -116,9 +119,13 @@ public void setLayoutAnimationEnabled(boolean enabled) {
public void updateProperties(int tag, ReactStylesDiffMap props) {
UiThreadUtil.assertOnUiThread();
- ViewManager viewManager = resolveViewManager(tag);
- View viewToUpdate = resolveView(tag);
- viewManager.updateProperties(viewToUpdate, props);
+ try {
+ ViewManager viewManager = resolveViewManager(tag);
+ View viewToUpdate = resolveView(tag);
+ viewManager.updateProperties(viewToUpdate, props);
+ } catch (IllegalViewOperationException e) {
+ Log.e(TAG, "Unable to update properties for view tag " + tag, e);
+ }
}
public void updateViewExtraData(int tag, Object extraData) {

0 comments on commit 8e91843

Please sign in to comment.