Fix windows compile class vs. struct confusion in e300c8c32d73
[pdfium.git] / fpdfsdk / src / fpdf_ext.cpp
index 2d9e5ae..93f6e18 100644 (file)
@@ -172,15 +172,15 @@ void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code)
                if(pRootDict->KeyExist("Names"))
                {
                        CPDF_Dictionary* pNameDict = pRootDict->GetDict("Names");
-                       if(pNameDict->KeyExist("EmbeddedFiles"))
+                       if (pNameDict && pNameDict->KeyExist("EmbeddedFiles"))
                        {
                                FPDF_UnSupportError(FPDF_UNSP_DOC_ATTACHMENT);
                                return;
                        }
-                       else if(pNameDict->KeyExist("JavaScript"))
+                       else if (pNameDict && pNameDict->KeyExist("JavaScript"))
                        {
                                CPDF_Dictionary* pJSDict = pNameDict->GetDict("JavaScript");
-                               CPDF_Array * pArray = pJSDict->GetArray("Names");
+                               CPDF_Array * pArray = pJSDict ? pJSDict->GetArray("Names") : NULL;
                                if (pArray) {
                                        int nCount = pArray->GetCount();
                                        for(int i=0; i<nCount; i++)
@@ -219,10 +219,10 @@ void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code)
 
 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document)
 {
-       if (!document) return PAGEMODE_UNKONOWN;
+       if (!document) return PAGEMODE_UNKNOWN;
        CPDF_Dictionary *pRoot = ((CPDF_Document*)document)->GetRoot();
        if (!pRoot)
-               return PAGEMODE_UNKONOWN;
+               return PAGEMODE_UNKNOWN;
        CPDF_Object* pName = pRoot->GetElement("PageMode");
        if (!pName)
                return PAGEMODE_USENONE;
@@ -241,5 +241,5 @@ DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document)
        else if (strPageMode.EqualNoCase(FX_BSTR("UseAttachments")))
                return PAGEMODE_USEATTACHMENTS;
 
-       return PAGEMODE_UNKONOWN;
+       return PAGEMODE_UNKNOWN;
 }