[ios] Return nil instead of a webview if staticHTMLNativeContent's view controller is nil

While the app is clearing browsing data, web usage is not enabled. So to prevent CHECK crash,
return nil when StaticHtmlNativeContent is not presenting web content.

Bug: 857199
Change-Id: I76320563f3237198e29c508c01e6c8df51da6a9c
Reviewed-on: https://chromium-review.googlesource.com/1237404
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593083}
diff --git a/ios/chrome/browser/ui/static_content/static_html_native_content.mm b/ios/chrome/browser/ui/static_content/static_html_native_content.mm
index 88b71b8..a760841 100644
--- a/ios/chrome/browser/ui/static_content/static_html_native_content.mm
+++ b/ios/chrome/browser/ui/static_content/static_html_native_content.mm
@@ -109,6 +109,16 @@
 }
 
 - (UIView*)view {
+  // During app teardown and when an offline reading list page is open,
+  // CRWWebController attempts to remove StaticHtmlNativeContent's web view from
+  // superview. While the app is clearing browsing data, though, web usage is
+  // not enabled. While returning nil whenever |_staticHTMLViewController| is
+  // nil is not ideal solution, this file will get removed soon in a refactor
+  // (crbug.com/725239), so it will serve to just prevent crashing.
+  if (!_staticHTMLViewController) {
+    return nil;
+  }
+
   CHECK(_webUsageEnabled) << "Tried to create a web view when web usage was"
                           << " disabled!";
   return [_staticHTMLViewController webView];