Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1348)

Unified Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp

Issue 361553002: Remove "this==NULL" and adjust corresponding callers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix if check warning Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fpdfapi/fpdf_resource.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index 243c23fabf9cff737801c8b78a64e1e2bdb6c931..e33a99ba63fb42dfa3756f1a371f2f7e735d2668 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -48,7 +48,7 @@ void CPDF_PageContentGenerate::GenerateContent()
}
ProcessImage(buf, (CPDF_ImageObject*)pPageObj);
}
- CPDF_Object* pContent = pPageDict->GetElementValue("Contents");
+ CPDF_Object* pContent = pPageDict ? pPageDict->GetElementValue("Contents") : NULL;
if (pContent != NULL) {
pPageDict->RemoveAt("Contents");
}
@@ -94,7 +94,8 @@ void CPDF_PageContentGenerate::ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObje
FX_DWORD dwSavedObjNum = pStream->GetObjNum();
CFX_ByteString name = RealizeResource(pStream, "XObject");
if (dwSavedObjNum == 0) {
- pImageObj->m_pImage->Release();
+ if (pImageObj->m_pImage)
+ pImageObj->m_pImage->Release();
pImageObj->m_pImage = m_pDocument->GetPageData()->GetImage(pStream);
}
buf << "/" << PDF_NameEncode(name) << " Do Q\n";
@@ -119,7 +120,8 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data
}
void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix)
{
- CPDF_Object* pContent = m_pPage->m_pFormDict->GetElementValue("Contents");
+ CPDF_Dictionary* pDict = m_pPage->m_pFormDict;
+ CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL;
if (!pContent) {
return;
}
« no previous file with comments | « core/include/fpdfapi/fpdf_resource.h ('k') | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698