Commit 047ce30

Richard Luby <richluby@gmail.com>
2016-10-27 11:50:59
fixed crashing on empty string
1 parent 32e8584
Changed files (1)
client.go
@@ -76,6 +76,9 @@ func initUserSession() {
 		fmt.Printf("\n:> ")
 		input, _ = reader.ReadString('\n')
 		args := strings.Fields(input)
+		if len(args) < 1 { // skip the empty strings
+			continue
+		}
 		// select a command from the list of available commands
 		if command, err = selectCommand(strings.TrimSpace(args[0])); err != nil {
 			log.Printf("Error while selecting command: %+v", err)