Add missing null check
This commit is contained in:
parent
b002621861
commit
e18a740b20
1 changed files with 6 additions and 1 deletions
|
@ -12,6 +12,7 @@ import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
import okhttp3.RequestBody;
|
import okhttp3.RequestBody;
|
||||||
import okhttp3.Response;
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
||||||
private static final String TAG = "LbryBufferEvent";
|
private static final String TAG = "LbryBufferEvent";
|
||||||
|
@ -53,7 +54,11 @@ public class BufferEventTask extends AsyncTask<Void, Void, Void> {
|
||||||
build();
|
build();
|
||||||
|
|
||||||
Response response = client.newCall(request).execute();
|
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));
|
Log.d(TAG, String.format("buffer event sent: %s", responseString));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// we don't want to fail if a buffer event fails to register
|
// we don't want to fail if a buffer event fails to register
|
||||||
|
|
Loading…
Reference in a new issue