Skip to content

Commit

Permalink
Don't try to decode if the result is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Mar 14, 2014
1 parent abac668 commit 78dd1b0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion framework/OpenXchange/lib/Horde/OpenXchange/Base.php
Expand Up @@ -156,7 +156,8 @@ protected function _login()
* @param array $params URL parameters.
* @param array|string $data Request data.
*
* @return array The decoded result data.
* @return array The decoded result data or null if no data has been
* returned but the request was still successful.
* @throws Horde_OpenXchange_Exception.
*/
protected function _request($method, $namespace, $params, $data = array())
Expand Down Expand Up @@ -199,6 +200,9 @@ protected function _request($method, $namespace, $params, $data = array())
$body = $response->getBody();
$data = json_decode($body, true);
if (!$data) {
if ($response->code == 200) {
return;
}
throw new Horde_OpenXchange_Exception($body);
}
if (isset($data['error'])) {
Expand Down

0 comments on commit 78dd1b0

Please sign in to comment.