Bgerstle has submitted this change and it was merged.

Change subject: Fix T96603 - wrapping section html creation in an exception 
handler.
......................................................................


Fix T96603 - wrapping section html creation in an exception handler.

Also added a default text for sections that do not display properly.

Change-Id: I2fcdea0ed819b8dc2e6c18a2a0d8a32629f98e7e
---
M Wikipedia/View Controllers/WebView/WebViewController.m
M Wikipedia/en.lproj/Localizable.strings
M Wikipedia/qqq.lproj/Localizable.strings
3 files changed, 15 insertions(+), 5 deletions(-)

Approvals:
  Bgerstle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Wikipedia/View Controllers/WebView/WebViewController.m 
b/Wikipedia/View Controllers/WebView/WebViewController.m
index 5cb88f3..eeccf01 100644
--- a/Wikipedia/View Controllers/WebView/WebViewController.m
+++ b/Wikipedia/View Controllers/WebView/WebViewController.m
@@ -1560,13 +1560,21 @@
     NSMutableArray* sectionTextArray = [[NSMutableArray alloc] init];
 
     for (MWKSection* section in session.currentArticle.sections) {
-        NSString* html = section.text;
-        if (html) {
-            // Structural html added around section html just before display.
-            NSString* sectionHTMLWithID = [section displayHTML:html];
+        NSString* html = nil;
 
-            [sectionTextArray addObject:sectionHTMLWithID];
+        @try {
+            html = section.text;
+        }@catch (NSException* exception) {
+            NSAssert(html, @"html was not created from section %@: %@", 
section.title, section.text);
         }
+
+        if (!html) {
+            html = MWLocalizedString(@"article-unable-to-load-section", nil);;
+        }
+
+        // Structural html added around section html just before display.
+        NSString* sectionHTMLWithID = [section displayHTML:html];
+        [sectionTextArray addObject:sectionHTMLWithID];
     }
 
     // If article has no thumbnailImage, use the first section image instead.
diff --git a/Wikipedia/en.lproj/Localizable.strings 
b/Wikipedia/en.lproj/Localizable.strings
index 8b2f73e..b5d0aab 100644
--- a/Wikipedia/en.lproj/Localizable.strings
+++ b/Wikipedia/en.lproj/Localizable.strings
@@ -3,6 +3,7 @@
 "article-languages-downloading" = "Loading article languages...";
 "article-languages-filter-placeholder" = "Language Filter";
 "article-read-more-title" = "Read more";
+"article-unable-to-load-section" = "Unable to load this section. Try 
refreshing the article to see if it fixes the problem.";
 
 "info-box-title" = "Quick facts";
 "info-box-close-text" = "Close";
diff --git a/Wikipedia/qqq.lproj/Localizable.strings 
b/Wikipedia/qqq.lproj/Localizable.strings
index ffddc9a..4d60907 100644
--- a/Wikipedia/qqq.lproj/Localizable.strings
+++ b/Wikipedia/qqq.lproj/Localizable.strings
@@ -276,3 +276,4 @@
 "hockeyapp-alert-privacy" = "Alert dialog button text for HockeyApp privacy 
policy. $1 will be replaced programmatically with the constant string 
'HockeyApp'";
 "page-issues" = "Label for button that shows the Page issues dialog.";
 "page-similar-titles" = "Label for button that shows a list of similar titles 
(disambiguation) for the current page";
+"article-unable-to-load-section" = "Displayed within the article content when 
a section fails to render for some reason.";

-- 
To view, visit https://gerrit.wikimedia.org/r/206864
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2fcdea0ed819b8dc2e6c18a2a0d8a32629f98e7e
Gerrit-PatchSet: 5
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Fjalapeno <cfl...@wikimedia.org>
Gerrit-Reviewer: Bgerstle <bgers...@wikimedia.org>
Gerrit-Reviewer: Mhurd <mh...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to