http://a/%%30%30 crashes WebKit

My browser based on WebKit crashes when I try to load http://a/%%30%30 with exception "Unexpectedly found nil while unwrapping an Optional value".

@IBOutlet weak var webView: WKWebView! webView.uiDelegate = self webView.navigationDelegate = self webView.customUserAgent = Browser.UserAgent() let config = webView.configuration config.applicationNameForUserAgent = Browser.name config.preferences.javaScriptEnabled = true webView.scrollView.delegate = self webView.scrollView.isScrollEnabled = true webView.scrollView.keyboardDismissMode = .onDrag

The crash actually occurs when I return the URL value:

if fullURL.contains("http://") || fullURL.contains("https://") { return URL(string: query)! }

And then the webpage is loaded:

webView.load(url)

I have removed the "!" from the return function of the URL and I am required to provide a default value or force-unwrap, which leads to a crash.

Is this a problem with my code or with WebKit?

http://a/%%30%30 crashes WebKit
 
 
Q