From 721d020e085f9403ceccdaa530d8632756ae5635 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 12 Oct 2018 17:43:56 +0000 Subject: Remove redundent ASSERT + if checks in CPDF_FormControl. Change-Id: Iedaf9447513d7142359771c81c49f03f8bca28d7 Reviewed-on: https://pdfium-review.googlesource.com/c/43935 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- core/fpdfdoc/cpdf_formcontrol.cpp | 18 ++++++------------ 1 file 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"; -- cgit v1.2.3