Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2c38967

Browse files
kangwang1988jason-simmons
authored andcommitted
Fix a minikin crash (nullptr& EXC_BAD_ACCESS) on iOS8. (#6795)
* Fix a minikin crash (nullptr& EXC_BAD_ACCESS) on iOS8. * Use find for vector to avoid side effect.
1 parent faabf0c commit 2c38967

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

third_party/txt/src/txt/font_collection.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ FontCollection::GetMinikinFontCollectionForFamily(
132132
minikin_family,
133133
};
134134
if (enable_font_fallback_) {
135-
for (std::string fallback_family : fallback_fonts_for_locale_[locale])
136-
minikin_families.push_back(fallback_fonts_[fallback_family]);
135+
for (std::string fallback_family : fallback_fonts_for_locale_[locale]) {
136+
auto it = fallback_fonts_.find(fallback_family);
137+
if (it != fallback_fonts_.end()) {
138+
minikin_families.push_back(it->second);
139+
}
140+
}
137141
}
138142

139143
// Create the minikin font collection.

0 commit comments

Comments
 (0)