Index: core/src/fpdfapi/fpdf_font/fpdf_font.cpp |
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp |
index 72b8adbe20022d2c54d372f01c68137660c0a156..b7ca5b1b7df9a35f659f94389485e1e6f23a0eab 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; |
} |