Fix nil completor

This commit is contained in:
Eyal Posener 2019-11-22 11:48:06 +02:00
parent e8bbd08d57
commit 0f93c0740c
1 changed files with 4 additions and 1 deletions

View File

@ -52,8 +52,11 @@ func (c Config) Predict(prefix string) []string {
}
func (c Config) Check(value string) error {
if !c.check || c.Predictor == nil {
return nil
}
predictions := c.Predictor.Predict(value)
if !c.check || len(predictions) == 0 {
if len(predictions) == 0 {
return nil
}
for _, vv := range predictions {