diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-02-22 22:37:12 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-02-22 22:37:12 +0100 |
commit | d47c009ec5bc15afbd7792ce236a02a712edb2ac (patch) | |
tree | ab280c4c9f8e387bf88155bf0cf1c10635e304a1 /sw | |
parent | 33a3a5a7eb52ed6a883216cbba83f620f00f61b1 (diff) |
sw: WW8 import: avoid assert on ooo99613-3.doc and ooo99613-4.doc
sw/source/core/txtnode/thints.cxx:1244: bool SwTextNode::InsertHint(SwTextAttr*, SetAttrMode): Assertion `!pAttr->GetEnd() || (*pAttr->GetEnd() <= Len())' failed.
These files were created by a buggy OOo and Word 2010 considers them
corrupt and pops up scary warning dialogs, so just avoid inserting hints
with invalid positions, there's not really anything fixable here.
Change-Id: I65b5b963d7b4e28fd9551ccadd71b581f118106c
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/basflt/fltshell.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 7d8745ec14b6..73b26e35f220 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -148,7 +148,11 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, // The content indices always apply to the node! rRegion.GetPoint()->nNode = rMkPos.m_nNode.GetIndex() + 1; SwContentNode* pCNd = GetContentNode(pDoc, rRegion.GetPoint()->nNode, true); - rRegion.GetPoint()->nContent.Assign(pCNd, rMkPos.m_nContent); + + SAL_WARN_IF(pCNd->Len() < rMkPos.m_nContent, "sw.ww8", + "invalid content index " << rMkPos.m_nContent << " but text node has only " << pCNd->Len()); + rRegion.GetPoint()->nContent.Assign(pCNd, + std::min<sal_Int32>(rMkPos.m_nContent, pCNd->Len())); rRegion.SetMark(); if (rMkPos.m_nNode != rPtPos.m_nNode) { @@ -159,7 +163,10 @@ bool SwFltStackEntry::MakeRegion(SwDoc* pDoc, SwPaM& rRegion, bool bCheck, rRegion.GetPoint()->nNode = n; pCNd = GetContentNode(pDoc, rRegion.GetPoint()->nNode, false); } - rRegion.GetPoint()->nContent.Assign(pCNd, rPtPos.m_nContent); + SAL_WARN_IF(pCNd->Len() < rPtPos.m_nContent, "sw.ww8", + "invalid content index " << rPtPos.m_nContent << " but text node has only " << pCNd->Len()); + rRegion.GetPoint()->nContent.Assign(pCNd, + std::min<sal_Int32>(rPtPos.m_nContent, pCNd->Len())); OSL_ENSURE( CheckNodesRange( rRegion.Start()->nNode, rRegion.End()->nNode, true ), "attribute or similar crosses section-boundaries" ); |