diff --git a/src/crm/api/response/CommonAPIResponse.php b/src/crm/api/response/CommonAPIResponse.php index d42c4f09..c7888814 100644 --- a/src/crm/api/response/CommonAPIResponse.php +++ b/src/crm/api/response/CommonAPIResponse.php @@ -112,10 +112,15 @@ public function setResponseJSON() $headerMap[$firstHalf] = trim($secondHalf); } } - $jsonResponse = json_decode($content, true); - if ($jsonResponse == null && $this->httpStatusCode != APIConstants::RESPONSECODE_NO_CONTENT) { - list ($headers, $content) = explode("\r\n\r\n", $content, 2); + + $jsonResponse = []; + if($content) + { $jsonResponse = json_decode($content, true); + if ($jsonResponse == null && $this->httpStatusCode != APIConstants::RESPONSECODE_NO_CONTENT) { + list ($headers, $content) = explode("\r\n\r\n", $content, 2); + $jsonResponse = json_decode($content, true); + } } $this->responseJSON = $jsonResponse; $this->responseHeaders = $headerMap; @@ -324,4 +329,4 @@ public function getAPIName() { return $this->apiName; } -} \ No newline at end of file +}