Browse Source

Deivce closing if error

Denis V. Dedkov 9 years ago
parent
commit
157d60fc6d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      noolite.go

+ 2 - 0
noolite.go

@@ -91,11 +91,13 @@ func NewNooliteAdapter(mode, bitrate, repeats uint) (*NooliteAdapter, error) {
 
 	d.Configuration(1)
 	if d.LastError() != "No error" {
+		d.Close()
 		return nil, errors.New(d.LastError())
 	}
 
 	d.Interface(0)
 	if d.LastError() != "No error" {
+		d.Close()
 		return nil, errors.New(d.LastError())
 	}