Merge to XFA: Land: Protect against a seg fault in CPDF_StructElementImpl constructor
authorTom Sepez <tsepez@chromium.org>
Fri, 9 Jan 2015 00:40:19 +0000 (16:40 -0800)
committerTom Sepez <tsepez@chromium.org>
Fri, 9 Jan 2015 00:40:19 +0000 (16:40 -0800)
Original CL at https://codereview.chromium.org/841943003/

TBR=jam@chromium.org

Review URL: https://codereview.chromium.org/845603004

core/src/fpdfdoc/doc_tagged.cpp

index 6981573..c5fe39b 100644 (file)
@@ -217,9 +217,11 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree, CPDF_
     m_pTree = pTree;
     m_pDict = pDict;
     m_Type = pDict->GetString(FX_BSTRC("S"));
-    CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type);
-    if (!mapped.IsEmpty()) {
-        m_Type = mapped;
+    if (pTree->m_pRoleMap) {
+        CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type);
+        if (!mapped.IsEmpty()) {
+            m_Type = mapped;
+        }
     }
     m_pParent = pParent;
     LoadKids(pDict);