summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-12 17:43:56 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-12 17:43:56 +0000
commit721d020e085f9403ceccdaa530d8632756ae5635 (patch)
tree1d84b82c8a1ce320079eda8e06c51127d9a797c4 /core/fpdfdoc
parentac0a1672378b4b2e18b01080a5c149ff50abd363 (diff)
downloadpdfium-721d020e085f9403ceccdaa530d8632756ae5635.tar.xz
Remove redundent ASSERT + if checks in CPDF_FormControl.
Change-Id: Iedaf9447513d7142359771c81c49f03f8bca28d7 Reviewed-on: https://pdfium-review.googlesource.com/c/43935 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 06b578d71b..a1f1f8f26e 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -59,11 +59,8 @@ ByteString CPDF_FormControl::GetCheckedAPState() const {
ASSERT(GetType() == CPDF_FormField::kCheckBox ||
GetType() == CPDF_FormField::kRadioButton);
ByteString csOn = GetOnStateName();
- if (GetType() == CPDF_FormField::kRadioButton ||
- GetType() == CPDF_FormField::kCheckBox) {
- if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt")))
- csOn = ByteString::Format("%d", m_pField->GetControlIndex(this));
- }
+ if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt")))
+ csOn = ByteString::Format("%d", m_pField->GetControlIndex(this));
if (csOn.IsEmpty())
csOn = "Yes";
return csOn;
@@ -73,13 +70,10 @@ WideString CPDF_FormControl::GetExportValue() const {
ASSERT(GetType() == CPDF_FormField::kCheckBox ||
GetType() == CPDF_FormField::kRadioButton);
ByteString csOn = GetOnStateName();
- if (GetType() == CPDF_FormField::kRadioButton ||
- GetType() == CPDF_FormField::kCheckBox) {
- if (CPDF_Array* pArray =
- ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"))) {
- int iIndex = m_pField->GetControlIndex(this);
- csOn = pArray->GetStringAt(iIndex);
- }
+ CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"));
+ if (pArray) {
+ int iIndex = m_pField->GetControlIndex(this);
+ csOn = pArray->GetStringAt(iIndex);
}
if (csOn.IsEmpty())
csOn = "Yes";