From fe94078194dbfaa2faa37786bbc18f3919fda004 Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Mon, 2 May 2022 11:31:14 -0500 Subject: [PATCH] Avoid a null pointer deference --- bridge/portal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridge/portal.go b/bridge/portal.go index f8eb998..36f0e28 100644 --- a/bridge/portal.go +++ b/bridge/portal.go @@ -455,7 +455,7 @@ func (p *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Message) key := database.PortalKey{msg.MessageReference.ChannelID, user.ID} existing := p.bridge.db.Message.GetByDiscordID(key, msg.MessageReference.MessageID) - if existing.MatrixID != "" { + if existing != nil && existing.MatrixID != "" { content.RelatesTo = &event.RelatesTo{ Type: event.RelReply, EventID: existing.MatrixID,