Skip to content

Instantly share code, notes, and snippets.

@frosty
Created August 1, 2018 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frosty/e6573e7d07592e0f367d4c4081025fb5 to your computer and use it in GitHub Desktop.
Save frosty/e6573e7d07592e0f367d4c4081025fb5 to your computer and use it in GitHub Desktop.
diff --git a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift
index 6b051320c6..a656ae6f9a 100644
--- a/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift
+++ b/WordPress/Classes/ViewRelated/Reader/ReaderStreamViewController.swift
@@ -384,16 +384,27 @@ import WordPressFlux
// MARK: - Handling Loading and No Results
+ private func setStatusViewTitle(_ title: String, message: String) {
+ // Potential fix for a crash where it seems we attempted to update the status view
+ // title or message before the IBOutlets were connected: https://github.com/wordpress-mobile/WordPress-iOS/issues/9745
+ guard isViewLoaded else {
+ return
+ }
+
+ resultsStatusView.titleText = title
+ resultsStatusView.messageText = message
+ }
+
@objc func displayLoadingStream() {
- resultsStatusView.titleText = NSLocalizedString("Loading stream...", comment: "A short message to inform the user the requested stream is being loaded.")
- resultsStatusView.messageText = ""
+ setStatusViewTitle(NSLocalizedString("Loading stream...", comment: "A short message to inform the user the requested stream is being loaded."),
+ message: "")
displayResultsStatus()
}
@objc func displayLoadingStreamFailed() {
- resultsStatusView.titleText = NSLocalizedString("Problem loading stream", comment: "Error message title informing the user that a stream could not be loaded.")
- resultsStatusView.messageText = NSLocalizedString("Sorry. The stream could not be loaded.", comment: "A short error message leting the user know the requested stream could not be loaded.")
+ setStatusViewTitle(NSLocalizedString("Problem loading stream", comment: "Error message title informing the user that a stream could not be loaded."),
+ message: NSLocalizedString("Sorry. The stream could not be loaded.", comment: "A short error message leting the user know the requested stream could not be loaded."))
displayResultsStatus()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment