Fix crash when loading a custom colorscheme

When using `cs, err := ...` in a nested scope, it masks `cs` and `err`
from any parent scope.
This commit is contained in:
Markus Peloquin 2020-03-14 23:02:05 -07:00
parent 025527730f
commit 43227744e7

View File

@ -18,14 +18,11 @@ func init() {
}
func FromName(confDir configdir.ConfigDir, c string) (Colorscheme, error) {
cs, ok := registry[c]
if !ok {
cs, err := getCustomColorscheme(confDir, c)
if err != nil {
return cs, err
}
if cs, ok := registry[c]; ok {
return cs, nil
}
return cs, nil
cs, err := getCustomColorscheme(confDir, c)
return cs, err
}
func register(name string, c Colorscheme) {