Fixing crash when url is not http[s] and using in app Safari.

This commit is contained in:
Samuel Clay 2022-01-10 13:58:19 -05:00
parent 5438b54955
commit 500d4edae6

View file

@ -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];