diff options
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r-- | fpdfsdk/formfiller/cba_fontmap.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index b7e14b4636..0daa0cd5ac 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -217,12 +217,14 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(ByteString* sAlias) { return nullptr; CPDF_DefaultAppearance appearance(sDA); - ASSERT(appearance.HasFont()); - float font_size; - ByteString sDecodedFontName = - PDF_NameDecode(appearance.GetFont(&font_size).AsStringView()); - *sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1); + Optional<ByteString> font = appearance.GetFont(&font_size); + if (font) { + ByteString sDecodedFontName = PDF_NameDecode(font->AsStringView()); + *sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1); + } else { + *sAlias = ByteString(); + } CPDF_Dictionary* pFontDict = nullptr; if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictFor("AP")) { |