| Index: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| index 3f915a7b7989200d204037458d0029ef62a539a2..924a965e6463069b31367c4c8f7076bb10e0c4a4 100644
|
| --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| @@ -118,14 +118,13 @@ FX_BOOL CPDF_ShadingPattern::Load() {
|
| }
|
| CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
|
| if (pFunc) {
|
| - if (pFunc->GetType() == PDFOBJ_ARRAY) {
|
| - m_nFuncs = ((CPDF_Array*)pFunc)->GetCount();
|
| - if (m_nFuncs > 4) {
|
| + if (CPDF_Array* pArray = pFunc->AsArray()) {
|
| + m_nFuncs = pArray->GetCount();
|
| + if (m_nFuncs > 4)
|
| m_nFuncs = 4;
|
| - }
|
| +
|
| for (int i = 0; i < m_nFuncs; i++) {
|
| - m_pFunctions[i] =
|
| - CPDF_Function::Load(((CPDF_Array*)pFunc)->GetElementValue(i));
|
| + m_pFunctions[i] = CPDF_Function::Load(pArray->GetElementValue(i));
|
| }
|
| } else {
|
| m_pFunctions[0] = CPDF_Function::Load(pFunc);
|
|
|