summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2019-11-22 11:48:06 +0200
committerEyal Posener <[email protected]>2019-11-22 11:48:06 +0200
commit0f93c0740cb6ed49e04cc32292dc554b9b129a6f (patch)
treea1e758e6b288d9451700fe8e9b7650128279ce78
parente8bbd08d57dcfee050a1b098e793cea633b5d35c (diff)
Fix nil completor
-rw-r--r--predict/options.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/predict/options.go b/predict/options.go
index df39437..1c34feb 100644
--- a/predict/options.go
+++ b/predict/options.go
@@ -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 {