Skip to content

Commit

Permalink
Fix NPE in cancelling network calls
Browse files Browse the repository at this point in the history
Summary:
Issue reported here
facebook#7755 (comment)

Converting int to Integer explicitly and not cancelling the call more than once
should fix it.

Reviewed By: bestander

Differential Revision: D3371238

fbshipit-source-id: cb00663b4ca19a788bd27b971b6447cc0788a818
  • Loading branch information
andreicoman11 authored and Facebook Github Bot 8 committed Jun 3, 2016
1 parent 8fe5884 commit 5de1151
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ public static void cancelTag(OkHttpClient client, Object tag) {
for (Call call : client.dispatcher().queuedCalls()) {
if (tag.equals(call.request().tag())) {
call.cancel();
return;
}
}
for (Call call : client.dispatcher().runningCalls()) {
if (tag.equals(call.request().tag())) {
call.cancel();
return;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ private void cancelRequest(final int requestId) {
new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
@Override
protected void doInBackgroundGuarded(Void... params) {
OkHttpCallUtil.cancelTag(mClient, requestId);
OkHttpCallUtil.cancelTag(mClient, Integer.valueOf(requestId));
}
}.execute();
}
Expand Down

0 comments on commit 5de1151

Please sign in to comment.