Skip to content

Commit da28201

Browse files
authored
Merge pull request #24 from skrobul/fix-devices-response
bugfix: NoMethodError when response does not include device list
2 parents db98c1e + faf6a9e commit da28201

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/zenoss/jsonapi/device_router.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
#
44
#
55
# This file is part of zenoss_client.
6-
#
6+
#
77
# zenoss_client is free software: you can redistribute it and/or
88
# modify it under the terms of the GNU General Public License as published
99
# by the Free Software Foundation, either version 3 of the License, or (at
1010
# your option) any later version.
11-
#
11+
#
1212
# zenoss_client is distributed in the hope that it will be useful,
1313
# but WITHOUT ANY WARRANTY; without even the implied warranty of
1414
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1515
# Public License for more details.
16-
#
16+
#
1717
# You should have received a copy of the GNU General Public License along
1818
# with zenoss_client. If not, see <http://www.gnu.org/licenses/>.
1919
#############################################################################
@@ -44,7 +44,7 @@ def get_devices(uid = '/zport/dmd/Devices', opts = {})
4444
resp = json_request('DeviceRouter', 'getDevices', [data])
4545

4646
devs = []
47-
resp['devices'].each do |dev|
47+
resp['devices'] && resp['devices'].each do |dev|
4848
devs << Model::Device.new(self, dev)
4949
end
5050
devs

0 commit comments

Comments
 (0)