Browse Source

Device closing was moved

Denis V. Dedkov 9 years ago
parent
commit
4319da7d95
1 changed files with 2 additions and 1 deletions
  1. 2 1
      noolite-cli.go

+ 2 - 1
noolite-cli.go

@@ -20,12 +20,13 @@ func sendCommand(command string, channel, value, r, g, b int) error {
 	}
 
 	n, err := noolite.DefaultNooliteAdapter()
-	defer n.Close()
 
 	if err != nil {
 		return err
 	}
 
+	defer n.Close()
+
 	if command == "set" {
 		if value != 0 {
 			return n.SetBrightnesValue(channel, value)