From 8e15e602834e101ee5b829e220ab9cc828c6d87e Mon Sep 17 00:00:00 2001 From: Yury Melnichek Date: Thu, 10 Mar 2011 13:56:32 +0100 Subject: [PATCH] Fix crash in Sloynik, when invalid link is followed. --- iphone_sloynik/Shared/ArticleVC.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/iphone_sloynik/Shared/ArticleVC.mm b/iphone_sloynik/Shared/ArticleVC.mm index 41efd19fe5..e0dff164fc 100644 --- a/iphone_sloynik/Shared/ArticleVC.mm +++ b/iphone_sloynik/Shared/ArticleVC.mm @@ -248,7 +248,13 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { - string const url([[[request URL] path] UTF8String]); + char const * urlChars = [[[request URL] path] UTF8String]; + if (!urlChars) + { + LOG(LWARNING, ("Strange URL: path is empty.")); + return NO; + } + string const url(urlChars); size_t const lastSlash = url.find_last_of('/'); if (lastSlash == string::npos) {