summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-24 17:40:44 +0100
committerEike Rathke <erack@redhat.com>2011-11-24 17:40:44 +0100
commit49846da1652661e73acffd1ee8df0419aadf5cdb (patch)
treeee6fe78f99915c6e3451ed972f6b2fabfb6e7c76 /xmloff
parentec9f3466d33536f68d86bde9f0389f46f8f147a2 (diff)
fdo#43152 ooo#114415 fixed crash on unnamed form element
An unnamed form element without parent container lead to a crash when trying to obtain a unique name by iterating over (now not) existing container elements.
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/forms/elementimport.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 3fde263f6022..10c4b2f61efa 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -495,8 +495,11 @@ namespace xmloff
{
// no optimization here. If this method gets called, the XML stream did not contain a name for the
// element, which is a heavy error. So in this case we don't care for performance
- Sequence< ::rtl::OUString > aNames = m_xParentContainer->getElementNames();
static const ::rtl::OUString sUnnamedName(RTL_CONSTASCII_USTRINGPARAM("unnamed"));
+ OSL_ENSURE(m_xParentContainer.is(), "OElementImport::implGetDefaultName: no parent container!");
+ if (!m_xParentContainer.is())
+ return sUnnamedName;
+ Sequence< ::rtl::OUString > aNames = m_xParentContainer->getElementNames();
::rtl::OUString sReturn;
const ::rtl::OUString* pNames = NULL;