From 287e11a213d3197ac3e321acf294d903b271c269 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Mon, 30 Jun 2014 09:49:21 -0700 Subject: Remove "this==NULL" and adjust corresponding callers BUG= R=thakis@chromium.org Review URL: https://codereview.chromium.org/361553002 --- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'core/src/fpdfapi/fpdf_font') diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 72b8adbe20..b7ca5b1b7d 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -78,7 +78,9 @@ void CPDF_FontGlobals::Clear(void* key) CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value; for (int i = 0; i < 14; i ++) { if (pStockFonts->m_pStockFonts[i]) { - pStockFonts->m_pStockFonts[i]->GetFontDict()->Release(); + CPDF_Dictionary* pFontDict = pStockFonts->m_pStockFonts[i]->GetFontDict(); + if (pFontDict) + pFontDict->Release(); delete pStockFonts->m_pStockFonts[i]; } } @@ -97,7 +99,9 @@ void CPDF_FontGlobals::ClearAll() CFX_StockFontArray* pStockFonts = (CFX_StockFontArray*)value; for (int i = 0; i < 14; i ++) { if (pStockFonts->m_pStockFonts[i]) { - pStockFonts->m_pStockFonts[i]->GetFontDict()->Release(); + CPDF_Dictionary* pFontDict = pStockFonts->m_pStockFonts[i]->GetFontDict(); + if (pFontDict) + pFontDict->Release(); delete pStockFonts->m_pStockFonts[i]; } } @@ -1698,7 +1702,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) if (name == NULL) { return NULL; } - CPDF_Stream* pStream = (CPDF_Stream*)m_pCharProcs->GetElementValue(name); + CPDF_Stream* pStream = (CPDF_Stream*)(m_pCharProcs ? m_pCharProcs->GetElementValue(name) : NULL); if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { return NULL; } -- cgit v1.2.3