Skip to content

connector: ignore messages that convert to nothing instead of panicking - #287

Merged
iFixRobots merged 1 commit into
mainfrom
iFixRobots/line-nil-convert-ignored
Oct 26, 2026
Merged

iFixRobots merged 1 commit into
mainfrom
iFixRobots/line-nil-convert-ignored

Conversation

@iFixRobots

Copy link
Copy Markdown
Contributor

Several conversion paths return nil, nil to skip a message: whitespace-only text, an image with no OID or download URL, and some post notifications. Backfill already treats a nil result as "skip". Live events, though, pass it straight to bridgev2, which dereferences it in Portal.getRelationMeta:

error Event handling panicked  error="runtime error: invalid memory address or nil pointer dereference"
  maunium.net/go/mautrix/bridgev2.(*Portal).getRelationMeta       bridgev2/portal.go:2937
  maunium.net/go/mautrix/bridgev2.(*Portal).sendConvertedMessage  bridgev2/portal.go:3050

The panic gets recovered, so the message is skipped anyway, but each one logs a panic and a stack trace. The live-event ConvertMessageFunc now turns a nil result into bridgev2.ErrIgnoringRemoteEvent, which is how bridgev2 expects a converter to say "skip this". Handling it at that one boundary covers every current and future nil, nil path without touching each handler.

Before After
Live message that converts to nothing recovered panic, skipped ignored, skipped
Backfill skipped unchanged

Before / after: not run, because the messages that trigger this can't be produced on demand.

View in Indent
Tag @indent to continue the conversation here.

@indent

indent Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Issues

No issues found.

CI Checks

All CI checks passed on 610e10f.

Review agents

Select any unchecked box below to run or rerun that agent.

Passed (1)
  • Indent Review Agent · No issues found; nil conversions now ignored.
Full results

Indent Review Agent

  • Summary: No issues found; nil conversions now ignored.
  • Last ran on commit: 610e10f9
  • Latest result
    {
      "summary": "No issues found; nil conversions now ignored.",
      "findings": []
    }

@iFixRobots
iFixRobots merged commit 68f7c11 into main Oct 26, 2026
9 checks passed
@iFixRobots
iFixRobots deleted the iFixRobots/line-nil-convert-ignored branch October 26, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants