Don't explode when autocompleting nothing.
authorAndrey Petrov <andrey.petrov@shazow.net>
Tue, 10 Feb 2015 20:04:19 +0000 (12:04 -0800)
committerAndrey Petrov <andrey.petrov@shazow.net>
Tue, 10 Feb 2015 20:04:19 +0000 (12:04 -0800)
Fixes #126.

host.go

diff --git a/host.go b/host.go
index ddaa260f638f57d13778e6c75942fe20527d83c1..ca17f70560d64eb47bd4b5ab32c7fffc67de76c8 100644 (file)
--- a/host.go
+++ b/host.go
@@ -199,7 +199,7 @@ func (h *Host) AutoCompleteFunction(u *message.User) func(line string, pos int,
                        return
                }
 
-               if strings.HasSuffix(line[:pos], " ") {
+               if line == "" || strings.HasSuffix(line[:pos], " ") {
                        // Don't autocomplete spaces.
                        return
                }