Chromium Code Reviews| Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp |
| diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp |
| index 36cc9db754dd2cce7d8f310e54d6ddae3f68e00e..e4b93a0792da0a75118bcb3ac07bb01d40660d7f 100644 |
| --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp |
| +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp |
| @@ -111,7 +111,8 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const |
| } |
| CFX_WideString CFDF_Document::GetWin32Path() const |
| { |
| - CPDF_Object* pFileSpec = m_pRootDict->GetDict(FX_BSTRC("FDF"))->GetElementValue(FX_BSTRC("F")); |
| + CPDF_Dictionary* pDict = m_pRootDict->GetDict(FX_BSTRC("FDF")); |
|
Nico
2014/06/28 01:01:07
is m_pRootDict guaranteed to be not NULL here?
|
| + CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue(FX_BSTRC("F")) : NULL; |
| if (pFileSpec == NULL) { |
| return CFX_WideString(); |
| } |
| @@ -203,7 +204,10 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) |
| if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) { |
| wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS"))); |
| } |
| - } else { |
| + } |
| + else if (!pFileSpec) |
| + wsFileName = CFX_WideString(); |
| + else { |
| wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString()); |
| } |
| if (wsFileName[0] != '/') { |