Skip to content

Commit

Permalink
Account for devices which are not commanders
Browse files Browse the repository at this point in the history
  • Loading branch information
zankich committed Dec 3, 2014
1 parent be963f9 commit f1e94b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f1e94b5

Please sign in to comment.