Fix a null object bug
authorBo Xu <bo_xu@foxitsoftware.com>
Wed, 9 Jul 2014 21:03:51 +0000 (14:03 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Wed, 9 Jul 2014 21:03:51 +0000 (14:03 -0700)
BUG=387975
R=thakis@chromium.org

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

core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

index 9261177..b79aad6 100644 (file)
@@ -1211,7 +1211,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum)
     if (m_ObjectStreamMap.Lookup((void*)(FX_UINTPTR)objnum, (void*&)pStreamAcc)) {
         return pStreamAcc;
     }
-    const CPDF_Stream* pStream = (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum);
+    const CPDF_Stream* pStream = m_pDocument ? (CPDF_Stream*)m_pDocument->GetIndirectObject(objnum) : NULL;
     if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) {
         return NULL;
     }