Remove more dead code in cpdf_interactiveform.cpp.
Replace more unreachable code with asserts.
Change-Id: I62c085847aba5157c5ca7dded1c82e49aa0ec466
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/73124
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Hui Yingst <nigi@chromium.org>
diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp
index 914b5d3..2df45fd0 100644
--- a/core/fpdfdoc/cpdf_interactiveform.cpp
+++ b/core/fpdfdoc/cpdf_interactiveform.cpp
@@ -198,6 +198,9 @@
ByteString csFontName,
RetainPtr<CPDF_Font>& pFont,
ByteString* csNameTag) {
+ if (csFontName.IsEmpty())
+ return false;
+
CPDF_Dictionary* pDR = pFormDict->GetDictFor("DR");
if (!pDR)
return false;
@@ -206,9 +209,7 @@
if (!ValidateFontResourceDict(pFonts))
return false;
- if (csFontName.GetLength() > 0)
- csFontName.Remove(' ');
-
+ csFontName.Remove(' ');
CPDF_DictionaryLocker locker(pFonts);
for (const auto& it : locker) {
const ByteString& csKey = it.first;
@@ -268,8 +269,7 @@
}
void InitDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
- if (!pDocument)
- return;
+ ASSERT(pDocument);
if (!pFormDict) {
pFormDict = pDocument->NewIndirect<CPDF_Dictionary>();
@@ -561,10 +561,9 @@
return pFont;
}
ByteString csFontName = GetNativeFontName(charSet, nullptr);
- if (!csFontName.IsEmpty() &&
- FindFontFromDoc(pFormDict, pDocument, csFontName, pFont, csNameTag)) {
+ if (FindFontFromDoc(pFormDict, pDocument, csFontName, pFont, csNameTag))
return pFont;
- }
+
pFont = AddNativeFont(charSet, pDocument);
if (!pFont)
return nullptr;