Merge pull request #885 from DevilDimon/dock_string_crash_fix

Ignore non-URL strings when opening URLs
This commit is contained in:
Mitch Livingston 2020-04-20 08:20:59 -04:00 committed by GitHub
commit cd2587a435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -1269,8 +1269,15 @@ static void removeKeRangerRansomware()
else
urlString = [@"http://" stringByAppendingString: urlString];
}
NSURL * url = [NSURL URLWithString: urlString];
if (url == nil)
{
NSLog(@"Detected non-URL string \"%@\". Ignoring.", urlString);
return;
}
NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: urlString]
NSURLRequest * request = [NSURLRequest requestWithURL: url
cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
if (fPendingTorrentDownloads[[request URL]])