Fix a null object check
authorBo Xu <bo_xu@foxitsoftware.com>
Wed, 9 Jul 2014 17:56:52 +0000 (10:56 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Wed, 9 Jul 2014 17:56:52 +0000 (10:56 -0700)
BUG=390615
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/378293005

core/src/fpdfdoc/doc_basic.cpp

index 25f641c..5ccf4ce 100644 (file)
@@ -46,7 +46,9 @@ int CPDF_Dest::GetZoomMode()
     if (m_pObj == NULL || m_pObj->GetType() != PDFOBJ_ARRAY) {
         return 0;
     }
-    CFX_ByteString mode = ((CPDF_Array*)m_pObj)->GetElementValue(1)->GetString();
+    CFX_ByteString mode;
+    CPDF_Object* pObj = ((CPDF_Array*)m_pObj)->GetElementValue(1);
+    mode = pObj ? pObj->GetString() : CFX_ByteString();
     int i = 0;
     while (g_sZoomModes[i][0] != '\0') {
         if (mode == g_sZoomModes[i]) {