mautrix / discord

A Matrix-Discord puppeting bridge
https://go.mau.fi/mautrix-discord
GNU Affero General Public License v3.0
253 stars 21 forks source link

nil pointer dereference when trying to send a DM #63

Closed Lykos153 closed 1 year ago

Lykos153 commented 1 year ago

What happened:

  1. I wrote a DM in Discord so the bridge creates a portal
  2. The portal was created and I was able to see the message
  3. I wrote a message in that portal
  4. The message never arrived to discord, the logs showed this:
│ mautrix-bridge [Feb 28, 2023 22:01:32] [Matrix/DEBUG] Starting handling of transaction 152252 (1 EDUs (unstable))           │
│ mautrix-bridge [Feb 28, 2023 22:01:42] [Matrix/DEBUG] Starting handling of transaction 152253 (1 EDUs (unstable))           │
│ mautrix-bridge [Feb 28, 2023 22:01:44] [Matrix/DEBUG] Starting handling of transaction 152254 (1 PDUs)                      │
│ mautrix-bridge panic: runtime error: invalid memory address or nil pointer dereference                                      │
│ mautrix-bridge [signal SIGSEGV: segmentation violation code=0x1 addr=0x360 pc=0x78c23f]                                     │
│ mautrix-bridge                                                                                                              │
│ mautrix-bridge goroutine 710 [running]:                                                                                     │
│ mautrix-bridge github.com/bwmarrin/discordgo.(*Session).ChannelMessageSendComplex(0x0, {0xc0003bec90, 0x12}, 0xc0008cd790,  │
│ {0x0, 0x0, 0x0})                                                                                                            │
│ mautrix-bridge     /builds/mautrix/discord/.cache/pkg/mod/github.com/beeper/discordgo@v0.0.0-20230215201850-32771907474d/re │
│ stapi.go:1936 +0x25f                                                                                                        │
│ mautrix-bridge main.(*Portal).handleMatrixMessage(0xc000303400, 0xc0020541b0, 0xc0017c1080)                                 │
│ mautrix-bridge     /builds/mautrix/discord/portal.go:1693 +0x126e                                                           │
│ mautrix-bridge main.(*Portal).handleMatrixMessages(0xc000303400, {0xc0017c1080?, 0xc0020541b0?})                            │
│ mautrix-bridge     /builds/mautrix/discord/portal.go:1382 +0xdd                                                             │
│ mautrix-bridge main.(*Portal).messageLoop(0xc000303400)                                                                     │
│ mautrix-bridge     /builds/mautrix/discord/portal.go:251 +0xe5                                                              │
│ mautrix-bridge created by main.(*DiscordBridge).NewPortal                                                                   │
│ mautrix-bridge     /builds/mautrix/discord/portal.go:242 +0x285                                                             │
tulir commented 1 year ago

That seems like it should only happen if you're not logged in 🤔

tulir commented 1 year ago

Probably won't happen more in any case