Index: third_party/WebKit/Source/platform/text/Hyphenation.cpp |
diff --git a/third_party/WebKit/Source/platform/text/Hyphenation.cpp b/third_party/WebKit/Source/platform/text/Hyphenation.cpp |
index b636494c99e008b86f30b02fe60ab432e2195081..64405f6c756e9c56b5be098620747dddf0654391 100644 |
--- a/third_party/WebKit/Source/platform/text/Hyphenation.cpp |
+++ b/third_party/WebKit/Source/platform/text/Hyphenation.cpp |
@@ -18,10 +18,12 @@ Hyphenation* Hyphenation::get(const AtomicString& locale) |
{ |
DCHECK(!locale.isNull()); |
Hyphenation::HyphenationMap& hyphenationMap = getHyphenationMap(); |
- auto result = hyphenationMap.add(locale, nullptr); |
- if (result.isNewEntry) |
- result.storedValue->value = platformGetHyphenation(locale); |
- return result.storedValue->value.get(); |
+ const auto& it = hyphenationMap.find(locale); |
+ if (it != hyphenationMap.end()) |
+ return it->value.get(); |
+ |
+ return hyphenationMap.add(locale, platformGetHyphenation(locale)) |
+ .storedValue->value.get(); |
} |
void Hyphenation::setForTesting(const AtomicString& locale, PassRefPtr<Hyphenation> hyphenation) |