diff --git a/modules/skparagraph/src/FontCollection.cpp b/modules/skparagraph/src/FontCollection.cpp index ec47018938..7595cfc90e 100644 --- a/modules/skparagraph/src/FontCollection.cpp +++ b/modules/skparagraph/src/FontCollection.cpp @@ -96,8 +96,8 @@ std::vector> FontCollection::findTypefaces(const std::vector FontCollection::matchTypeface(const SkString& familyName, SkFontStyle fontStyle) { for (const auto& manager : this->getFontManagerOrder()) { - SkFontStyleSet* set = manager->matchFamily(familyName.c_str()); - if (nullptr == set || set->count() == 0) { + sk_sp set(manager->matchFamily(familyName.c_str())); + if (!set || set->count() == 0) { continue; }