From 3a1cb2fc78ae886caf6ff76581c2d86cdd075685 Mon Sep 17 00:00:00 2001 From: Gary Kramlich Date: Mon, 2 May 2022 09:29:38 -0500 Subject: [PATCH] Make sure we've acquired the room lock before checking the mxid --- bridge/portal.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge/portal.go b/bridge/portal.go index 27f5bd4..0fbdae8 100644 --- a/bridge/portal.go +++ b/bridge/portal.go @@ -172,14 +172,14 @@ func (p *Portal) MainIntent() *appservice.IntentAPI { } func (p *Portal) createMatrixRoom(user *User, channel *discordgo.Channel) error { + p.roomCreateLock.Lock() + defer p.roomCreateLock.Unlock() + // If we have a matrix id the room should exist so we have nothing to do. if p.MXID != "" { return nil } - p.roomCreateLock.Lock() - defer p.roomCreateLock.Unlock() - p.Type = channel.Type if p.Type == discordgo.ChannelTypeDM { p.DMUser = channel.Recipients[0].ID