Skip to content

Commit c561cc6

Browse files
committed
Fixed nil pointer error
1 parent 2296327 commit c561cc6

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/discord/bot.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1683,13 +1683,17 @@ func encodeAction(action Action, mediaID *media.ID) string {
16831683

16841684
func uniqueUser(m *discordgo.Member, u *discordgo.User) string {
16851685
userName := "unknown"
1686+
id := "unknown"
16861687
if m != nil {
16871688
userName = m.DisplayName()
1689+
id = shortID(m.User.ID)
16881690
}
16891691
if userName == "" && u != nil {
16901692
userName = u.Username
1693+
id = shortID(u.ID)
16911694
}
1692-
return userName + " (" + shortID(m.User.ID) + ")"
1695+
1696+
return userName + " (" + id + ")"
16931697
}
16941698

16951699
func shortID(longID string) string {

0 commit comments

Comments
 (0)