diff options
-rw-r--r-- | libs/minikin/FontCollection.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp index 348c5dc..a6977fd 100644 --- a/libs/minikin/FontCollection.cpp +++ b/libs/minikin/FontCollection.cpp @@ -48,9 +48,6 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) : FontFamily* family = typefaces[i]; MinikinFont* typeface = family->getClosestMatch(defaultStyle).font; if (typeface == NULL) { - ALOGE("FontCollection: closest match was null"); - // TODO: we shouldn't hit this, as there should be more robust - // checks upstream to prevent empty/invalid FontFamily objects continue; } family->RefLocked(); @@ -76,6 +73,8 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) : lastChar.push_back(instance->mCoverage->nextSetBit(0)); } nTypefaces = mInstances.size(); + LOG_ALWAYS_FATAL_IF(nTypefaces == 0, + "Font collection must have at least one valid typeface"); size_t nPages = (mMaxChar + kPageMask) >> kLogCharsPerPage; size_t offset = 0; for (size_t i = 0; i < nPages; i++) { @@ -144,6 +143,9 @@ const FontCollection::FontInstance* FontCollection::getInstanceForChar(uint32_t } } } + if (bestInstance == NULL) { + bestInstance = &mInstances[0]; + } return bestInstance; } |