From bc2ce3915bc63bcd643700464d095ddbb10d33fd Mon Sep 17 00:00:00 2001 From: IntriguingTiles Date: Thu, 27 May 2021 17:40:51 -0600 Subject: [PATCH] Fix Apollo crash on 1.10.9 --- tweak/Apollo.h | 1 + tweak/Apollo.xm | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tweak/Apollo.h b/tweak/Apollo.h index 25b5220..72eced3 100644 --- a/tweak/Apollo.h +++ b/tweak/Apollo.h @@ -77,6 +77,7 @@ @interface MarkdownRenderer + (id)attributedStringFromMarkdown:(id)arg1 withAttributes:(id)arg2; ++ (id)attributedStringFromMarkdown:(id)arg1 withAttributes:(id)arg2 isForPreview:(BOOL)arg3; @end @interface ActionController diff --git a/tweak/Apollo.xm b/tweak/Apollo.xm index 6a4b2aa..dba8964 100644 --- a/tweak/Apollo.xm +++ b/tweak/Apollo.xm @@ -318,7 +318,12 @@ id apolloCommentsControllerForContext; NSAttributedString *newAuthorAttributedString = [[NSAttributedString alloc] initWithString:author attributes:authorStringAttributes]; [authorNode setAttributedTitle:newAuthorAttributedString forState:UIControlStateNormal]; - [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + @try { + [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + } + @catch (NSException *exc) { + [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes isForPreview:NO]]; + } if ([data objectForKey:@"sender"]) { [data[@"sender"] setEnabled:YES]; @@ -377,7 +382,12 @@ id apolloCommentsControllerForContext; NSAttributedString* newAuthorAttributedString = [[NSAttributedString alloc] initWithString:authorTextString attributes:authorStringAttributes]; [authorNode setAttributedTitle:newAuthorAttributedString forState:UIControlStateNormal]; - [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + @try { + [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes]]; + } + @catch (NSException *exc) { + [bodyNode setAttributedString:[%c(MarkdownRenderer) attributedStringFromMarkdown:body withAttributes:apolloBodyAttributes isForPreview:NO]]; + } } %end