Skip to content

Commit

Permalink
Fix nil pointer error opening config file (#34)
Browse files Browse the repository at this point in the history
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")
  • Loading branch information
diogomatsubara committed Aug 23, 2023
1 parent 2772066 commit 744205a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func openConfig(path string) (*os.File, error) {

path = filepath.Join(xdg.Home, ".mctl.yml")
f, err := os.Open(path)
if err != nil {
if err == nil {
return f, nil
}
if !errors.Is(err, os.ErrNotExist) {
Expand Down

0 comments on commit 744205a

Please sign in to comment.