Index: core/src/fpdfdoc/doc_formcontrol.cpp |
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp |
index c5f47d20cb486160ea81d5e165c7c21ec34276ec..d29ac1e55b41ae52f78b6866b10f1953391d0d5e 100644 |
--- a/core/src/fpdfdoc/doc_formcontrol.cpp |
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp |
@@ -86,14 +86,13 @@ CFX_ByteString CPDF_FormControl::GetCheckedAPState() { |
if (GetType() == CPDF_FormField::RadioButton || |
GetType() == CPDF_FormField::CheckBox) { |
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"); |
Lei Zhang
2015/10/21 22:10:12
or just if (ToArray(FPDF_GetFieldAttr(m_pField->m_
dsinclair
2015/10/22 13:31:12
Done.
|
- if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) { |
+ if (pOpt && pOpt->IsArray()) { |
int iIndex = m_pField->GetControlIndex(this); |
csOn.Format("%d", iIndex); |
} |
} |
- if (csOn.IsEmpty()) { |
+ if (csOn.IsEmpty()) |
csOn = "Yes"; |
- } |
return csOn; |
} |
CFX_WideString CPDF_FormControl::GetExportValue() { |
@@ -103,9 +102,9 @@ CFX_WideString CPDF_FormControl::GetExportValue() { |
if (GetType() == CPDF_FormField::RadioButton || |
GetType() == CPDF_FormField::CheckBox) { |
CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"); |
- if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) { |
+ if (CPDF_Array* pArray = ToArray(pOpt)) { |
int iIndex = m_pField->GetControlIndex(this); |
- csOn = ((CPDF_Array*)pOpt)->GetString(iIndex); |
+ csOn = pArray->GetString(iIndex); |
} |
} |
if (csOn.IsEmpty()) { |