Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

Commit

Permalink
Exception for empty response
Browse files Browse the repository at this point in the history
  • Loading branch information
xboston committed Feb 1, 2022
1 parent 94798b4 commit 82e6a9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/MetaHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,13 @@ private function query(string $url, string $method, array $params = []): array
throw new RuntimeException('QueryTorrent Error: '.$response->getBody()->getContents());
}

return \json_decode($response->getBody()->getContents(), true);
$result = \json_decode($response->getBody()->getContents(), true);

if ($result === null) {
throw new RuntimeException('QueryTorrent Error: Empty response');
}

return $result;
}

/**
Expand Down

0 comments on commit 82e6a9e

Please sign in to comment.