From faf6a9edc8277f7c488efa6e8312be27e324ad06 Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Wed, 14 Sep 2016 14:48:30 +0100 Subject: [PATCH] bugfix: NoMethodError when response does not include device list --- lib/zenoss/jsonapi/device_router.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/zenoss/jsonapi/device_router.rb b/lib/zenoss/jsonapi/device_router.rb index 3f047fe..e0d9a31 100644 --- a/lib/zenoss/jsonapi/device_router.rb +++ b/lib/zenoss/jsonapi/device_router.rb @@ -3,17 +3,17 @@ # # # This file is part of zenoss_client. -# +# # zenoss_client is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Foundation, either version 3 of the License, or (at # your option) any later version. -# +# # zenoss_client is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. -# +# # You should have received a copy of the GNU General Public License along # with zenoss_client. If not, see . ############################################################################# @@ -44,7 +44,7 @@ def get_devices(uid = '/zport/dmd/Devices', opts = {}) resp = json_request('DeviceRouter', 'getDevices', [data]) devs = [] - resp['devices'].each do |dev| + resp['devices'] && resp['devices'].each do |dev| devs << Model::Device.new(self, dev) end devs