Fix nil pointer on User String method

(cherry picked from commit 74925cfcaf)
bot-api-6.1
maria.bagdasarova 2020-05-22 11:42:19 +03:00 committed by Syfaro
parent 1bdfd4d5e6
commit bd27dae566
1 changed files with 3 additions and 0 deletions

View File

@ -69,6 +69,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
} }