TGViewer
Telegram github commits and releases Telegram github commits and releases @tgappsupdates · 4.51K subscribers
Post #20499 142
UnigramDev/Unigram/crash-autocomplete-template-mismatch • 381ea2d • 1 files, +24/-14
Fix crash populating autocomplete rows from a mismatched template

Autocomplete_ContainerContentChanging walked the container's visual tree on
the assumption that it matches args.Item:

var content = args.ItemContainer.ContentTemplateRoot as Grid;
var title = content.Children[1] as TextBlock;
var description = title.Inlines[1] as Run;
...
description.Text = ...

The list uses ItemTemplateSelector, so containers are recycled across item
types that have different templates, and ContentTemplateRoot can still be the
previous type's tree when this fires. Every step of that walk is an `as` cast
whose result is dereferenced immediately, so a mismatch is a
NullReferenceException in an event handler — fatal, not caught anywhere.

Reported by crash telemetry on 12.8.2, landing on the QuickReplyShortcut
branch. args.InRecycleQueue was already handled; this is the other half of the
recycling problem, where the container is live but not yet re-templated.

Match the expected shape and bail out when it isn't there, rather than
indexing into whatever tree happens to be present. Applied to the reported
branch and to the User branch, which is structurally identical and has the
same latent fault.

The remaining branches index container children the same way and share the
pattern, but have no reported crashes; leaving them for now to keep the change
reviewable rather than rewriting the whole handler.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

#unigram
  • 🫡 2
More from @tgappsupdates
  1. Oct 16, 2026morethanwords/tweb/master • 3d8c282 • 1 files, +1/-1 Fragment numbers: 💎 instead of the p…
  2. Oct 16, 2026Ajaxy/telegram-tt/master • b0afc5e • 3 files, +4/-4 12.0.47 Ajaxy/telegram-tt/master • 6bf…
  3. Oct 15, 2026morethanwords/tweb/master • 1b86ca8 • 2 files, +23/-13 Caption field: the AI button sits o…
  4. Oct 15, 2026morethanwords/tweb/master • 7a1c7e2 • 1 files, +11/-2 Retry a language pack update that fa…
  5. Oct 15, 2026TGX-Android/Telegram-X/main • b960f4c • 1 files, +3/-2 Fix displaying call notification in…
  6. Oct 15, 2026TGX-Android/Telegram-X/main • d9d5897 • 1 files, +3/-2 Fix displaying call notifiaction in…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →