From 500d4edae640250a361fd88a982e4d295d32f4ee Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Mon, 10 Jan 2022 13:58:19 -0500 Subject: [PATCH] Fixing crash when url is not http[s] and using in app Safari. --- clients/ios/Classes/NewsBlurAppDelegate.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clients/ios/Classes/NewsBlurAppDelegate.m b/clients/ios/Classes/NewsBlurAppDelegate.m index 50ebd28fb..707d87594 100644 --- a/clients/ios/Classes/NewsBlurAppDelegate.m +++ b/clients/ios/Classes/NewsBlurAppDelegate.m @@ -2264,6 +2264,13 @@ - (void)showSafariViewControllerWithURL:(NSURL *)url useReader:(BOOL)useReader { SFSafariViewControllerConfiguration *config = [SFSafariViewControllerConfiguration new]; config.entersReaderIfAvailable = useReader; + + NSRange prefix = [[url absoluteString] rangeOfString: @"http"]; + if (NSNotFound == prefix.location) { + [self informError:@"URL scheme invalid"]; + return; + } + self.safariViewController = [[SFSafariViewController alloc] initWithURL:url configuration:config]; self.safariViewController.delegate = self; [self.storyPagesViewController setNavigationBarHidden:NO];