From f424b93bd8ddc04c6733f4db1ca74efc4e8cbd84 Mon Sep 17 00:00:00 2001 From: Nicolas Buquet Date: Wed, 22 Nov 2023 09:56:26 +0100 Subject: [PATCH] Fix crash when trying to display deleted message using Dynamic font --- Riot/Modules/MatrixKit/Views/MXKMessageTextView.m | 7 +++++-- changelog.d/929.bugfix | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 changelog.d/929.bugfix diff --git a/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m b/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m index 6cf574da0..fdbc037d3 100644 --- a/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m +++ b/Riot/Modules/MatrixKit/Views/MXKMessageTextView.m @@ -119,8 +119,11 @@ - (NSAttributedString *)respectPreferredFontForAttributedString:(NSAttributedStr inRange:NSMakeRange(0, workString.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { - [workString removeAttribute:NSFontAttributeName range:range]; - [workString addAttribute:NSFontAttributeName value:[(UIFont *)value fontWithSize:preferredFont.pointSize] range:range]; + if ([value isKindOfClass:UIFont.class]) + { + [workString removeAttribute:NSFontAttributeName range:range]; + [workString addAttribute:NSFontAttributeName value:[(UIFont *)value fontWithSize:preferredFont.pointSize] range:range]; + } }]; [workString endEditing]; diff --git a/changelog.d/929.bugfix b/changelog.d/929.bugfix new file mode 100644 index 000000000..b9d142d2e --- /dev/null +++ b/changelog.d/929.bugfix @@ -0,0 +1 @@ +Depuis la gestion dynamique de taille d'affichage dans les salons, l'application plante quand le salon contient un message supprimé. \ No newline at end of file