Fix nil pointer on User String method
This commit is contained in:
parent
5e339ed016
commit
74925cfcaf
1 changed files with 3 additions and 0 deletions
3
types.go
3
types.go
|
@ -64,6 +64,9 @@ type User struct {
|
|||
// It is normally a user's username, but falls back to a first/last
|
||||
// name as available.
|
||||
func (u *User) String() string {
|
||||
if u == nil {
|
||||
return ""
|
||||
}
|
||||
if u.UserName != "" {
|
||||
return u.UserName
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue