Skip to content

Commit

Permalink
ignore dropView method when view is null (facebook#24347)
Browse files Browse the repository at this point in the history
Summary:
In facebook#20288, we solved `com.facebook.react.uimanager.NativeViewHierarchyManager.dropView (NativeViewHierarchyManager.java:536)` by adding codes that prevent to run method on `view` object when `view.getId()` is null.

But if `view` is null, `view.getId()` can make error about NullPointerException. So, I think `dropView` method  needs to check if `view` is null.

If you need more information, Please read facebook#24346.

[Android] [Fixed] - Ignore dropView method when view is null.
Pull Request resolved: facebook#24347

Differential Revision: D14833822

Pulled By: cpojer

fbshipit-source-id: 88b6a05090ea8e8d6737c1f10b40e93649fab151
  • Loading branch information
7772 authored and dsyang committed Apr 12, 2019
1 parent 44cd53e commit 44b2ffa
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,10 @@ protected synchronized final void addRootViewGroup(int tag, View view) {
*/
protected synchronized void dropView(View view) {
UiThreadUtil.assertOnUiThread();
if (view == null) {
// Ignore this drop operation when view is null.
return;
}
if (mTagsToViewManagers.get(view.getId()) == null) {
// This view has already been dropped (likely due to a threading issue caused by async js
// execution). Ignore this drop operation.
Expand Down

0 comments on commit 44b2ffa

Please sign in to comment.