Skip to content

Commit a4bea22

Browse files
Fix nil pointer error opening config file
In case the config file exists in the home dir, use that one and return early, otherwise try to use the config file in xdg.ConfigFile("mctl/config.yaml")
1 parent 2772066 commit a4bea22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/app/app.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func openConfig(path string) (*os.File, error) {
4949

5050
path = filepath.Join(xdg.Home, ".mctl.yml")
5151
f, err := os.Open(path)
52-
if err != nil {
52+
if err == nil {
5353
return f, nil
5454
}
5555
if !errors.Is(err, os.ErrNotExist) {

0 commit comments

Comments
 (0)