summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Peloquin <markus@cs.wisc.edu>2020-03-14 23:02:05 -0700
committerMarkus Peloquin <markus@cs.wisc.edu>2020-04-01 11:20:45 -0700
commit43227744e7ed9821c4543fa1d6212a6f9418ceb9 (patch)
tree9444216657a92c2522c19bb131cde0a882164269
parent025527730fb350c42e106507c6b5d239258687bf (diff)
Fix crash when loading a custom colorscheme
When using `cs, err := ...` in a nested scope, it masks `cs` and `err` from any parent scope.
-rw-r--r--colorschemes/registry.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/colorschemes/registry.go b/colorschemes/registry.go
index 8f86491..b6263c9 100644
--- a/colorschemes/registry.go
+++ b/colorschemes/registry.go
@@ -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) {