From 0480de0cf4c7706186e06ed5744086d14925b835 Mon Sep 17 00:00:00 2001 From: Adrian Zankich Date: Tue, 12 Nov 2013 23:41:22 -0800 Subject: [PATCH] StartDriver is now optional --- device.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/device.go b/device.go index 8178563a..1805374b 100644 --- a/device.go +++ b/device.go @@ -23,7 +23,10 @@ func NewDevice(driver interface{}, r *Robot) *Device { func (d *Device) Start() { fmt.Println("Device " + d.Name + " started") - reflect.ValueOf(d.Driver).MethodByName("StartDriver").Call([]reflect.Value{}) + r := reflect.ValueOf(d.Driver).MethodByName("StartDriver") + if r.IsValid() { + r.Call([]reflect.Value{}) + } } func (d *Device) Command(method_name string, arguments []string) {