From 0ea472c386db81f8b576404cd7483ce209e10b70 Mon Sep 17 00:00:00 2001 From: leoleitemelo Date: Fri, 2 Dec 2022 18:57:27 -0300 Subject: [PATCH] fix for issue #32 validate if is different of null before check if it is an image --- src/android/com/adobe/phonegap/fetch/FetchPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/com/adobe/phonegap/fetch/FetchPlugin.java b/src/android/com/adobe/phonegap/fetch/FetchPlugin.java index 4820bfc..f8149e6 100644 --- a/src/android/com/adobe/phonegap/fetch/FetchPlugin.java +++ b/src/android/com/adobe/phonegap/fetch/FetchPlugin.java @@ -120,7 +120,7 @@ public void onResponse(Call call, Response response) throws IOException { result.put("headers", allHeaders); - if (response.body().contentType().type().equals("image")) { + if (response.body().contentType() != null && response.body().contentType().type().equals("image")) { result.put("isBlob", true); result.put("body", Base64.encodeToString(response.body().bytes(), Base64.DEFAULT)); } else {