summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp12
-rw-r--r--fpdfsdk/pwl/cpwl_appstream.cpp10
2 files changed, 14 insertions, 8 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")) {
diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp
index 0731398ae2..6e65831627 100644
--- a/fpdfsdk/pwl/cpwl_appstream.cpp
+++ b/fpdfsdk/pwl/cpwl_appstream.cpp
@@ -1184,9 +1184,13 @@ void CPWL_AppStream::SetAsPushButton() {
iColorType = da.GetColor(fc);
crText = CFX_Color(iColorType, fc[0], fc[1], fc[2], fc[3]);
}
- float fFontSize = 12.0f;
- if (da.HasFont())
- csNameTag = da.GetFont(&fFontSize);
+
+ float fFontSize;
+ Optional<ByteString> font = da.GetFont(&fFontSize);
+ if (font)
+ csNameTag = *font;
+ else
+ fFontSize = 12.0f;
WideString csWCaption;
WideString csNormalCaption;