Fixes NPE when NetworkingModule runs onCatalystInstanceDestroy

Reviewed By: andreicoman11

Differential Revision: D3328278

fbshipit-source-id: 7cf43a4564b2b799b13307f8604eb48e5c512379
This commit is contained in:
Konstantin Raev 2016-05-23 04:40:20 -07:00 committed by Facebook Github Bot 0
parent 913b4ccee4
commit 4378ecb8e1
2 changed files with 5 additions and 1 deletions

View File

@ -32,4 +32,8 @@ public class OkHttpCallUtil {
}
}
}
public static void cancelAll(OkHttpClient client) {
client.dispatcher().cancelAll();
}
}

View File

@ -138,7 +138,7 @@ public final class NetworkingModule extends ReactContextBaseJavaModule {
@Override
public void onCatalystInstanceDestroy() {
mShuttingDown = true;
OkHttpCallUtil.cancelTag(mClient, null);
OkHttpCallUtil.cancelAll(mClient);
mCookieHandler.destroy();
mCookieJarContainer.removeCookieJar();