Commit 852b58e3 authored by Avi Drissman's avatar Avi Drissman Committed by Commit Bot

Patch crash

For data gathering re SxS, apparently it's possible for Spotlight to
return a search query result for which there is no path. Defend
against this.

Bug: 1086555, 1061486
Change-Id: I972c6cda16d5c0801673addefd064cdfbc810904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218549
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772292}
parent 3bcd62d1
...@@ -114,6 +114,15 @@ void RecordChromeQueryResults(NSMetadataQuery* query) { ...@@ -114,6 +114,15 @@ void RecordChromeQueryResults(NSMetadataQuery* query) {
// Filed as FB7689234. // Filed as FB7689234.
NSString* app_path = base::mac::ObjCCast<NSString>( NSString* app_path = base::mac::ObjCCast<NSString>(
[result valueForAttribute:NSMetadataItemPathKey]); [result valueForAttribute:NSMetadataItemPathKey]);
if (!app_path) {
// It seems implausible, but there are Macs in the field for which
// Spotlight will find results for the query of locating Chrome but cannot
// actually return a path to the result. https://crbug.com/1086555
failed_to_read_plist = true;
*stop = YES;
return;
}
NSURL* app_url = [NSURL fileURLWithPath:app_path isDirectory:YES]; NSURL* app_url = [NSURL fileURLWithPath:app_path isDirectory:YES];
if ([app_url isEqual:this_url]) if ([app_url isEqual:this_url])
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment