Skip to content

Commit

Permalink
handle nil usr
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmturner committed Apr 21, 2018
1 parent 12002cb commit e1c4330
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions config/krb5conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ type LibDefaults struct {

// Create a new LibDefaults struct.
func newLibDefaults() *LibDefaults {
var uid string
uid := "0"
var hdir string
usr, err := user.Current()
if err != nil || usr == nil {
uid = "0"
} else {
usr, _ := user.Current()
if usr != nil {
uid = usr.Uid
hdir = usr.HomeDir
}
Expand Down

0 comments on commit e1c4330

Please sign in to comment.