X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae4adc3d0644b50636f0c3f6f06590b8a08cd6c8..7c60222510bc5e197b12f153c4bf05db66cb0f4a:/src/osx/webview_webkit.mm diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 9659efdb08..1609dfd59a 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -1291,9 +1291,23 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) NSURLRequest *request = [self request]; NSString* path = [[request URL] absoluteString]; + id client = [self client]; + wxString wxpath = wxStringWithNSString(path); wxString scheme = wxStringWithNSString([[request URL] scheme]); wxFSFile* file = g_stringHandlerMap[scheme]->GetFile(wxpath); + + if (!file) + { + NSError *error = [[NSError alloc] initWithDomain:NSURLErrorDomain + code:NSURLErrorFileDoesNotExist + userInfo:nil]; + + [client URLProtocol:self didFailWithError:error]; + + return; + } + size_t length = file->GetStream()->GetLength(); @@ -1307,8 +1321,6 @@ wxString nsErrorToWxHtmlError(NSError* error, wxWebViewNavigationError* out) file->GetStream()->Read(buffer, length); NSData *data = [[NSData alloc] initWithBytesNoCopy:buffer length:length]; - id client = [self client]; - //We do not support caching anything yet [client URLProtocol:self didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];