fix panic when config value set 0 (#1723)

This commit is contained in:
TerrySolar
2019-10-22 01:40:37 +08:00
committed by Derek Parker
parent fb3941324b
commit 52c395eb64

View File

@ -123,6 +123,9 @@ func configureSet(t *Term, args string) error {
if err != nil {
return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number", cfgname)
}
if n < 0 {
return reflect.ValueOf(nil), fmt.Errorf("argument to %q must be a number greater than zero", cfgname)
}
return reflect.ValueOf(&n), nil
case reflect.Bool:
v := rest == "true"