From 48fefde091fe15e783b0f18ca40c0fe2fd2580e0 Mon Sep 17 00:00:00 2001 From: aringenbach Date: Mon, 4 Jul 2022 15:12:22 +0200 Subject: [PATCH] Display fallback when replied event content is partially missing --- .../MatrixKit/Utils/EventFormatter/MXKEventFormatter.m | 9 ++++++++- changelog.d/6371.bugfix | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changelog.d/6371.bugfix diff --git a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m index 1aa344af6..77a8a0d39 100644 --- a/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m +++ b/Riot/Modules/MatrixKit/Utils/EventFormatter/MXKEventFormatter.m @@ -1854,6 +1854,13 @@ static NSString *const kHTMLATagRegexPattern = @"( MXJSONModelSetString(repliedEventContent, repliedEvent.content[kMXMessageBodyKey]); } } + + // No message content in a non-redacted event. Formatter should use fallback. + if (!repliedEventContent) + { + MXLogWarning(@"[MXKEventFormatter] Unable to retrieve content from replied event %@", repliedEvent.description) + return nil; + } } if (event.content[kMXMessageContentKeyNewContent]) @@ -1886,7 +1893,7 @@ static NSString *const kHTMLATagRegexPattern = @"( } else { - MXLogDebug(@"[MXKEventFormatter] Unable to build reply event %@", event.description) + MXLogWarning(@"[MXKEventFormatter] Unable to build reply event %@", event.description) } return html; diff --git a/changelog.d/6371.bugfix b/changelog.d/6371.bugfix new file mode 100644 index 000000000..7829efb59 --- /dev/null +++ b/changelog.d/6371.bugfix @@ -0,0 +1 @@ +Display fallback when replied event content is partially missing