From 7a2d8eda8dd8c37198d0e754218cdedd12e3fde4 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Tue, 4 Apr 2017 09:17:52 +0200 Subject: [PATCH] Fix exception when the response from the Icinga 2 API has an empty result set fixes #2805 --- .../Monitoring/Command/Transport/ApiCommandTransport.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/library/Monitoring/Command/Transport/ApiCommandTransport.php b/modules/monitoring/library/Monitoring/Command/Transport/ApiCommandTransport.php index bca3f80a1..6dc5fea24 100644 --- a/modules/monitoring/library/Monitoring/Command/Transport/ApiCommandTransport.php +++ b/modules/monitoring/library/Monitoring/Command/Transport/ApiCommandTransport.php @@ -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'],