Merge pull request #338 from pachmu/master

Fix nil pointer on User String method
bot-api-6.1
Kirill Zhuharev 2020-05-24 13:51:51 +03:00 committed by GitHub
commit 2339ed4639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -64,6 +64,9 @@ type User struct {
// It is normally a user's username, but falls back to a first/last // It is normally a user's username, but falls back to a first/last
// name as available. // name as available.
func (u *User) String() string { func (u *User) String() string {
if u == nil {
return ""
}
if u.UserName != "" { if u.UserName != "" {
return u.UserName return u.UserName
} }