summaryrefslogtreecommitdiffstats
path: root/base/win
diff options
context:
space:
mode:
authorgrt <grt@chromium.org>2015-06-30 06:47:51 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-30 13:48:31 +0000
commitd0c8a9902ff959e88413c3795d6ef9129bea0e2d (patch)
treec434cd854deb4641efacadab9370d60c582ccabe /base/win
parentcde556e2bc6d5095b864e626083a4a37cc1180e5 (diff)
downloadchromium_src-d0c8a9902ff959e88413c3795d6ef9129bea0e2d.zip
chromium_src-d0c8a9902ff959e88413c3795d6ef9129bea0e2d.tar.gz
chromium_src-d0c8a9902ff959e88413c3795d6ef9129bea0e2d.tar.bz2
Fix use of ShellDispatch.NameSpace -- may succeed but fail.
It returns S_FALSE (which isn't a failure) when the Folder can't be created. Handle this by checking for the absence of the folder. BUG=498383 Review URL: https://codereview.chromium.org/1217003002 Cr-Commit-Position: refs/heads/master@{#336775}
Diffstat (limited to 'base/win')
-rw-r--r--base/win/shortcut.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index 3ffb64d7..57f8e61 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -73,18 +73,18 @@ bool DoVerbOnFile(uint32_t resource_id, const FilePath& path) {
ScopedComPtr<Folder> folder;
hresult = shell_dispatch->NameSpace(
ScopedVariant(path.DirName().value().c_str()), folder.Receive());
- if (FAILED(hresult))
+ if (FAILED(hresult) || !folder.get())
return false;
ScopedComPtr<FolderItem> item;
hresult = folder->ParseName(ScopedBstr(path.BaseName().value().c_str()),
item.Receive());
- if (FAILED(hresult))
+ if (FAILED(hresult) || !item.get())
return false;
ScopedComPtr<FolderItemVerbs> verbs;
hresult = item->Verbs(verbs.Receive());
- if (FAILED(hresult))
+ if (FAILED(hresult) || !verbs.get())
return false;
long verb_count = 0;
@@ -95,7 +95,7 @@ bool DoVerbOnFile(uint32_t resource_id, const FilePath& path) {
for (long i = 0; i < verb_count; ++i) {
ScopedComPtr<FolderItemVerb> verb;
hresult = verbs->Item(ScopedVariant(i, VT_I4), verb.Receive());
- if (FAILED(hresult))
+ if (FAILED(hresult) || !verb.get())
continue;
ScopedBstr name;
hresult = verb->get_Name(name.Receive());