Avoid a null pointer deference

This commit is contained in:
Gary Kramlich
2022-05-02 11:31:14 -05:00
parent 0afd95398b
commit fe94078194

View File

@@ -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,