diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-06-20 14:16:12 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-06-20 14:56:43 +0200 |
commit | 8d5b4db6f928b5c240b3ea1ddaec60b1180187ce (patch) | |
tree | d28e87311f9a19dbfb2334e523f480ea8336b64e | |
parent | bdf2e1f5d4e8dee967b31b08c6c16691caf45243 (diff) | |
download | qtlocation-mapboxgl-8d5b4db6f928b5c240b3ea1ddaec60b1180187ce.tar.gz |
[android] make sure the object is still valid before calling nativeOnResponse()
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index 449e89a586..e0c63944b9 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -189,7 +189,11 @@ class HTTPRequest implements Callback { @Override public void onResponse(byte[] bytes) { if (bytes != null) { - nativeOnResponse(200, null, null, null, null, null, null, bytes); + lock.lock(); + if (nativePtr != 0) { + nativeOnResponse(200, null, null, null, null, null, null, bytes); + } + lock.unlock(); } } }).execute(resourceUrl); |