diff --git a/third_party/txt/src/txt/font_collection.cc b/third_party/txt/src/txt/font_collection.cc index a2399dd2d0d49..5503e54e03ff2 100644 --- a/third_party/txt/src/txt/font_collection.cc +++ b/third_party/txt/src/txt/font_collection.cc @@ -133,10 +133,9 @@ FontCollection::GetMinikinFontCollectionForFamily( }; if (enable_font_fallback_) { for (std::string fallback_family : fallback_fonts_for_locale_[locale]) { - std::shared_ptr fallback_font_ = - fallback_fonts_[fallback_family]; - if (fallback_font_.get() != nullptr) { - minikin_families.push_back(fallback_font_); + auto it = fallback_fonts_.find(fallback_family); + if (it != fallback_fonts_.end()) { + minikin_families.push_back(it->second); } } }