[Libreoffice-commits] .: xmloff/source

Eike Rathke erack at kemper.freedesktop.org
Thu Nov 24 08:41:12 PST 2011


 xmloff/source/forms/elementimport.cxx |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 49846da1652661e73acffd1ee8df0419aadf5cdb
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Nov 24 17:40:44 2011 +0100

    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.

diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 3fde263..10c4b2f 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;


More information about the Libreoffice-commits mailing list