The cause of this issue is that there is an indirect object like '112 0 R' but no...
[pdfium.git] / fpdfsdk / src / fpdfppo.cpp
index 032c3db..a5c4275 100644 (file)
@@ -215,8 +215,11 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic
        {
                if(pp->KeyExist((const char*)nSrctag))  
                        return pp->GetElement((const char*)nSrctag);
-               else if(pp->KeyExist("Parent"))
+               else if (pp->KeyExist("Parent"))
+               {
                        pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDirect();
+                       if (pp->GetType() == PDFOBJ_NULL) break;
+               }
                else break;
        }
        
@@ -310,9 +313,17 @@ int        CPDF_PageOrganizer::GetNewObjId(CPDF_Document *pDoc, CFX_MapPtrToPtr* pMapPt
        }
        else
        {
-               CPDF_Object* pClone  = pRef->GetDirect()->Clone();
-               if(!pClone)                     
+               CPDF_Object* pDirect = pRef->GetDirect();
+               if(!pDirect)
+               {
+                       return 0;
+               }
+
+               CPDF_Object* pClone = pDirect->Clone();
+               if(!pClone)
+               {
                        return 0;
+               }
                
                if(pClone->GetType() == PDFOBJ_DICTIONARY)
                {