From f1e94b5a1aeef11f45619d51da9296d8c7ea04d0 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Wed, 3 Dec 2014 10:59:19 -0800 Subject: [PATCH] Account for devices which are not commanders --- device.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/device.go b/device.go index b584f8ef..ed7045da 100644 --- a/device.go +++ b/device.go @@ -25,8 +25,10 @@ func NewJSONDevice(device Device) *JSONDevice { if device.Connection() != nil { jsonDevice.Connection = device.Connection().Name() } - for command := range device.(Commander).Commands() { - jsonDevice.Commands = append(jsonDevice.Commands, command) + if commander, ok := device.(Commander); ok { + for command := range commander.Commands() { + jsonDevice.Commands = append(jsonDevice.Commands, command) + } } return jsonDevice }