Index: core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
index 9a1d48a41610b9f04f3f8ff5f68102cbb4aea555..436cca6d99ce89aa7147f2c94ad20516e58be948 100644 |
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
@@ -343,10 +343,8 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(CPDF_Object* pCSObj, |
return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS; |
} |
- if (pCSObj->GetType() != PDFOBJ_ARRAY) |
- return nullptr; |
- CPDF_Array* pArray = (CPDF_Array*)pCSObj; |
- if (pArray->GetCount() == 0) |
+ CPDF_Array* pArray = pCSObj->AsArray(); |
+ if (!pArray || pArray->GetCount() == 0) |
return nullptr; |
if (pArray->GetCount() == 1) |
return GetColorSpace(pArray->GetElementValue(0), pResources); |