From e18a740b20c34876d69dd54d9a3ca0103fb5f238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patric=20Karlstr=C3=B6m?= Date: Wed, 13 Jan 2021 16:11:37 +0100 Subject: [PATCH] Add missing null check --- .../main/java/io/lbry/browser/tasks/BufferEventTask.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java b/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java index fa35ea92..8351d86f 100644 --- a/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/BufferEventTask.java @@ -12,6 +12,7 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; +import okhttp3.ResponseBody; public class BufferEventTask extends AsyncTask { private static final String TAG = "LbryBufferEvent"; @@ -53,7 +54,11 @@ public class BufferEventTask extends AsyncTask { build(); Response response = client.newCall(request).execute(); - String responseString = response.body().string(); + ResponseBody resBody = response.body(); + String responseString = ""; + if (resBody != null) { + responseString = response.body().string(); + } Log.d(TAG, String.format("buffer event sent: %s", responseString)); } catch (Exception ex) { // we don't want to fail if a buffer event fails to register