Fix exception when the response from the Icinga 2 API has an empty result set

fixes #2805
This commit is contained in:
Eric Lippmann 2017-04-04 09:17:52 +02:00
parent f7a8cf8a6e
commit 7a2d8eda8d
1 changed files with 3 additions and 1 deletions

View File

@ -215,7 +215,9 @@ class ApiCommandTransport implements CommandTransportInterface
);
}
$result = array_pop($response['results']);
if ($result['code'] < 200 || $result['code'] >= 300) {
if (! empty($result)
&& ($result['code'] < 200 || $result['code'] >= 300)
) {
throw new CommandTransportException(
'Can\'t send external Icinga command: %u %s',
$result['code'],