Skip to content

Commit

Permalink
Use find for vector to avoid side effect.
Browse files Browse the repository at this point in the history
  • Loading branch information
kangwang1988 committed Nov 9, 2018
1 parent a4e8f3e commit a4fba6d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions third_party/txt/src/txt/font_collection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ FontCollection::GetMinikinFontCollectionForFamily(
};
if (enable_font_fallback_) {
for (std::string fallback_family : fallback_fonts_for_locale_[locale]) {
std::shared_ptr<minikin::FontFamily> 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);
}
}
}
Expand Down

0 comments on commit a4fba6d

Please sign in to comment.