summaryrefslogtreecommitdiffstats
path: root/sw/source/core/unocore/unosect.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/unocore/unosect.cxx')
-rw-r--r--sw/source/core/unocore/unosect.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 338c37666217..9e3ba6b86483 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -400,6 +400,14 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
SwSection *const pRet =
pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 );
+ if (!pRet) // fdo#42450 text range could parially overlap existing section
+ {
+ // shouldn't have created an undo object yet
+ pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL );
+ throw lang::IllegalArgumentException(
+ "SwXTextSection::attach(): invalid TextRange",
+ static_cast< ::cppu::OWeakObject*>(this), 0);
+ }
pRet->GetFmt()->Add(m_pImpl.get());
pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));