Skip to content

Commit

Permalink
Fix NPE in FetchedAppGateKeepersManager
Browse files Browse the repository at this point in the history
Summary: There is a chance that callback from callbacks.poll() can be null, and it will introduce NPE issue

Reviewed By: dreamolight

Differential Revision: D17186898

fbshipit-source-id: 3f11e924c3485bb5611d11e5b88ecf358e0022be
  • Loading branch information
KylinChang authored and facebook-github-bot committed Sep 4, 2019
1 parent e878faf commit ac56790
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,15 @@ private static void pollCallbacks() {

while (!callbacks.isEmpty()) {
final Callback callback = callbacks.poll();
handler.post(new Runnable() {
@Override
public void run() {
callback.onCompleted();
}
});
// callback can be null when function pollCallbacks is called in multiple threads
if (callback != null) {
handler.post(new Runnable() {
@Override
public void run() {
callback.onCompleted();

This comment has been minimized.

Copy link
@backviet

backviet Sep 18, 2019

I think if (callback != null)should be check here

}
});
}
}
}

Expand Down

0 comments on commit ac56790

Please sign in to comment.