From b67e29c0bbda8653002aa1830dd16e8318487f5e Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Fri, 18 Feb 2022 18:41:08 -0500 Subject: [PATCH] Fix a crash on spoilers --- telegram/formatter/formatter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/telegram/formatter/formatter.go b/telegram/formatter/formatter.go index 2946a55..999d659 100644 --- a/telegram/formatter/formatter.go +++ b/telegram/formatter/formatter.go @@ -98,6 +98,10 @@ func EntityToMarkdown(entity *client.TextEntity) (*Insertion, *Insertion) { // EntityToXEP0393 generates the wrapping XEP-0393 tags func EntityToXEP0393(entity *client.TextEntity) (*Insertion, *Insertion) { + if entity == nil || entity.Type == nil { + return nil, nil + } + switch entity.Type.TextEntityTypeType() { case client.TypeTextEntityTypeBold: return markupBraces(entity, boldRunesXEP0393, boldRunesXEP0393)