Skip to content

Commit

Permalink
Prevent null-pointer access when user information is not set in URL
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jul 24, 2020
1 parent ddaf103 commit 858ef3e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cfg/aesbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ func getPassword(u *url.URL) (string, error) {
return p, nil
}

p = u.User.Username()
if p != "" {
return p, nil
if u.User != nil {
p = u.User.Username()
if p != "" {
return p, nil
}
}

return "", errors.New("password to encrypt or decrypt the config file not available")
Expand Down

0 comments on commit 858ef3e

Please sign in to comment.