summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-06-10 01:39:53 +0000
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-06-10 06:03:11 +0200
commit61cdc82f4df5e0b21ebdb9029651a22eb54c1cea (patch)
tree8ef606d9ddf5d076cb0a6178516bff7dd584b9f1
parentaad52f69e366735844d117e508e5b44d732fe8cf (diff)
fdo#37646: Avoid crash when pasting a form control into chart.
Signed-off-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--xmloff/source/forms/elementimport.cxx4
-rw-r--r--xmloff/source/forms/layerexport.cxx7
2 files changed, 9 insertions, 2 deletions
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 7f5688e869..99ce71fffd 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -252,7 +252,9 @@ namespace xmloff
m_sName = implGetDefaultName();
}
- m_xParentContainer->insertByName(m_sName, makeAny(m_xElement));
+ if (m_xParentContainer.is())
+ m_xParentContainer->insertByName(m_sName, makeAny(m_xElement));
+
LEAVE_LOG_CONTEXT( );
}
diff --git a/xmloff/source/forms/layerexport.cxx b/xmloff/source/forms/layerexport.cxx
index 2c2d5f4b1f..0052fc3741 100644
--- a/xmloff/source/forms/layerexport.cxx
+++ b/xmloff/source/forms/layerexport.cxx
@@ -347,6 +347,9 @@ namespace xmloff
//---------------------------------------------------------------------
sal_Bool OFormLayerXMLExport_Impl::implMoveIterators(const Reference< XDrawPage >& _rxDrawPage, sal_Bool _bClear)
{
+ if (!_rxDrawPage.is())
+ return false;
+
sal_Bool bKnownPage = sal_False;
// the one for the ids
@@ -406,7 +409,9 @@ namespace xmloff
//---------------------------------------------------------------------
::rtl::OUString OFormLayerXMLExport_Impl::getControlId(const Reference< XPropertySet >& _rxControl)
{
- OSL_ENSURE(m_aCurrentPageIds != m_aControlIds.end(), "OFormLayerXMLExport_Impl::getControlId: invalid current page!");
+ if (m_aCurrentPageIds == m_aControlIds.end())
+ return ::rtl::OUString();
+
OSL_ENSURE(m_aCurrentPageIds->second.end() != m_aCurrentPageIds->second.find(_rxControl),
"OFormLayerXMLExport_Impl::getControlId: can not find the control!");
return m_aCurrentPageIds->second[_rxControl];