Fix uninitialized RGB in GetRGB
[pdfium.git] / core / src / fpdfapi / fpdf_page / fpdf_page_parser_old.cpp
index cafca26..fe5e59c 100644 (file)
@@ -91,7 +91,7 @@ void CPDF_StreamContentParser::Handle_BeginImage()
         CPDF_Object* pObj = m_pSyntax->ReadNextObject();
         if (!key.IsEmpty()) {
             pDict->SetAt(key, pObj, m_pDocument);
-        } else {
+        } else if (pObj) {
             pObj->Release();
         }
     }
@@ -1036,8 +1036,8 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause)
                     for (i = 0; i < m_nStreams; i ++) {
                         FX_DWORD size = m_pStreamArray[i]->GetSize();
                         if (m_Size + size + 1 <= m_Size) {
-                                                       m_Status = Done;
-                                                       return;
+                            m_Status = Done;
+                            return;
                         }
                         m_Size += size + 1;
                     }
@@ -1064,7 +1064,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause)
             } else {
                 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents"));
                 m_pStreamArray[m_CurrentOffset] = FX_NEW CPDF_StreamAcc;
-                CPDF_Stream* pStreamObj = (CPDF_Stream*)pContent->GetElementValue(m_CurrentOffset);
+                CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->GetElementValue(m_CurrentOffset) : NULL);
                 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE);
                 m_CurrentOffset ++;
             }