Commit 259dcfaa authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Win Native Notifications: Fix crash when GetNamedItem returns null.

Bug: 881109, 734095
Change-Id: Ic530a30c653c202c279bf4074022a122cfcba2ac
Reviewed-on: https://chromium-review.googlesource.com/1209485
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589144}
parent aae79021
......@@ -88,6 +88,8 @@ enum class GetNotificationLaunchIdStatus {
GET_NODE_VALUE_FAILED = 8,
CONVERSION_TO_PROP_VALUE_FAILED = 9,
GET_STRING_FAILED = 10,
GET_NAMED_ITEM_NULL = 11,
GET_FIRST_CHILD_NULL = 12,
COUNT // Must be the final value.
};
......
......@@ -77,6 +77,13 @@ NotificationLaunchId GetNotificationLaunchId(
return NotificationLaunchId();
}
if (!leaf) {
LogGetNotificationLaunchIdStatus(
GetNotificationLaunchIdStatus::GET_NAMED_ITEM_NULL);
DLOG(ERROR) << "GetNamedItem returned null querying for 'launch' attribute";
return NotificationLaunchId();
}
mswr::ComPtr<winxml::Dom::IXmlNode> child;
hr = leaf->get_FirstChild(&child);
if (FAILED(hr)) {
......@@ -86,6 +93,13 @@ NotificationLaunchId GetNotificationLaunchId(
return NotificationLaunchId();
}
if (!child) {
LogGetNotificationLaunchIdStatus(
GetNotificationLaunchIdStatus::GET_FIRST_CHILD_NULL);
DLOG(ERROR) << "Launch attribute is a null node";
return NotificationLaunchId();
}
mswr::ComPtr<IInspectable> inspectable;
hr = child->get_NodeValue(&inspectable);
if (FAILED(hr)) {
......
......@@ -51627,6 +51627,8 @@ Full version information for the fingerprint enum values:
<int value="8" label="GET_NODE_VALUE_FAILED"/>
<int value="9" label="CONVERSION_TO_PROP_VALUE_FAILED"/>
<int value="10" label="GET_STRING_FAILED"/>
<int value="11" label="GET_NAMED_ITEM_NULL"/>
<int value="12" label="GET_FIRST_CHILD_NULL"/>
</enum>
<enum name="WindowsNotificationGetSettingPolicy">
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