fix #172, don't crash on empty name string on call to LookupTerminfo

This commit is contained in:
Jason E. Aten 2017-12-31 16:00:20 -06:00 committed by Garrett D'Amore
parent d400d66308
commit 1ef2313da8
1 changed files with 6 additions and 0 deletions

View File

@ -756,6 +756,12 @@ func loadFromFile(fname string, term string) (*Terminfo, error) {
// one from the JSON file located in either $TCELLDB, $HOME/.tcelldb
// or in this package's source directory as database.json).
func LookupTerminfo(name string) (*Terminfo, error) {
if name == "" {
// else on windows: index out of bounds
// on the name[0] reference below
return nil, ErrTermNotFound
}
dblock.Lock()
t := terminfos[name]
dblock.Unlock()