Do not assume that createTypeface is called before getStyle in the AssetManagerFontStyleSet (flutter/engine#14343)

This commit is contained in:
Jason Simmons 2019-12-13 09:23:08 -08:00 committed by GitHub
parent 879d79695a
commit 4dc714b8a4

View File

@ -84,7 +84,10 @@ void AssetManagerFontStyleSet::getStyle(int index,
SkString* name) {
FML_DCHECK(index < static_cast<int>(assets_.size()));
if (style) {
*style = assets_[index].typeface->fontStyle();
sk_sp<SkTypeface> typeface(createTypeface(index));
if (typeface) {
*style = typeface->fontStyle();
}
}
if (name) {
*name = family_name_.c_str();