Do not return a Minikin font collection if the SkFontStyleSet is unable to create any typefaces (flutter/engine#24951)

This commit is contained in:
Jason Simmons
2021-03-19 11:36:01 -07:00
committed by GitHub
parent 3acbafcda1
commit 77995f0b9a
2 changed files with 6 additions and 0 deletions

View File

@@ -117,6 +117,8 @@ SkTypeface* AssetManagerFontStyleSet::createTypeface(int i) {
// Ownership of the stream is transferred.
asset.typeface = SkTypeface::MakeFromStream(std::move(stream));
if (!asset.typeface) {
FML_DLOG(ERROR) << "Unable to load font asset for family: "
<< family_name_;
return nullptr;
}
}

View File

@@ -295,6 +295,10 @@ std::shared_ptr<minikin::FontFamily> FontCollection::CreateMinikinFontFamily(
}
}
if (skia_typefaces.empty()) {
return nullptr;
}
SortSkTypefaces(skia_typefaces);
std::vector<minikin::Font> minikin_fonts;