summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 1731079bdd..99120a0d51 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -951,9 +951,14 @@ RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
ByteString bsHash = ByteString::Format("%d, %d", wCodePage, dwFontStyles);
bsHash += FX_UTF8Encode(WideStringView(pszFontFamily));
uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringView(), false);
- std::vector<RetainPtr<CFGAS_GEFont>>* pFontArray = &m_Hash2Fonts[dwHash];
- if (!pFontArray->empty())
- return (*pFontArray)[0];
+ auto* pFontVector = &m_Hash2Fonts[dwHash];
+ if (!pFontVector->empty()) {
+ for (auto iter = pFontVector->begin(); iter != pFontVector->end(); ++iter) {
+ if (*iter != nullptr)
+ return *iter;
+ }
+ return nullptr;
+ }
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
const FX_FONTDESCRIPTOR* pFD =
@@ -989,7 +994,7 @@ RetainPtr<CFGAS_GEFont> CFGAS_FontMgr::GetFontByCodePage(
return nullptr;
pFont->SetLogicalFontStyle(dwFontStyles);
- pFontArray->push_back(pFont);
+ pFontVector->push_back(pFont);
return pFont;
}