Commit e5bd0f73 authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Commit Bot

Fix crash when map key is accessed without checking.

Bug: 1102937
Change-Id: Ib4ac8700bf147ec6aeff696c47f39592503f0447
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303455
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789460}
parent bf0bbdc4
...@@ -445,18 +445,20 @@ IFACEMETHODIMP BrowserAccessibilityComWin::get_attributes( ...@@ -445,18 +445,20 @@ IFACEMETHODIMP BrowserAccessibilityComWin::get_attributes(
*start_offset = FindStartOfStyle(offset, ax::mojom::MoveDirection::kBackward); *start_offset = FindStartOfStyle(offset, ax::mojom::MoveDirection::kBackward);
*end_offset = FindStartOfStyle(offset, ax::mojom::MoveDirection::kForward); *end_offset = FindStartOfStyle(offset, ax::mojom::MoveDirection::kForward);
const ui::TextAttributeList& attributes =
offset_to_text_attributes().find(*start_offset)->second;
std::ostringstream attributes_stream; std::ostringstream attributes_stream;
for (const ui::TextAttribute& attribute : attributes) { auto iter = offset_to_text_attributes().find(*start_offset);
// Don't expose the default language value of "en-US". if (iter != offset_to_text_attributes().end()) {
// TODO(nektar): Determine if it's possible to check against the interface const ui::TextAttributeList& attributes = iter->second;
// language.
if (attribute.first == "language" && attribute.second == "en-US") for (const ui::TextAttribute& attribute : attributes) {
continue; // Don't expose the default language value of "en-US".
// TODO(nektar): Determine if it's possible to check against the interface
attributes_stream << attribute.first << ":" << attribute.second << ";"; // language.
if (attribute.first == "language" && attribute.second == "en-US")
continue;
attributes_stream << attribute.first << ":" << attribute.second << ";";
}
} }
base::string16 attributes_str = base::UTF8ToUTF16(attributes_stream.str()); base::string16 attributes_str = base::UTF8ToUTF16(attributes_stream.str());
......
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