sw/qa/extras/ooxmlimport/data/tdf128076.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx     |   16 ++++++++++++++++
 sw/source/core/unocore/unofield.cxx          |    6 +++---
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 52485e1f3464ab69b38d2e240c8c364d6b78ceb8
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Oct 11 19:00:05 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofa...@libreoffice.org>
CommitDate: Tue Oct 15 10:56:42 2019 +0200

    tdf#128076: throw exception only if it's not alive and it's not a 
description
    
    According to a comment from https://gerrit.libreoffice.org/#/c/74533/
    
    okay... then i guess there are different kinds of callers:
    those who actually want to check if its a descriptor,
    and those who want to check that it isn't "live"
    
    so check if it's a description even if it's not alive
    
    Change-Id: I1526fdbcb006506cc67d29cbe3f65138f90843dc
    Reviewed-on: https://gerrit.libreoffice.org/80677
    Reviewed-by: Michael Stahl <michael.st...@cib.de>
    Tested-by: Michael Stahl <michael.st...@cib.de>
    (cherry picked from commit 802d034c55876c9a933206176a7882ac1ae7566e)
    Reviewed-on: https://gerrit.libreoffice.org/80764
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf128076.docx 
b/sw/qa/extras/ooxmlimport/data/tdf128076.docx
new file mode 100644
index 000000000000..69490a14554b
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf128076.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 4ee66606b7a6..94b6c66ac82d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -211,6 +211,22 @@ xray 
ThisComponent.DrawPage(1).getByIndex(0).Anchor.PageStyleName
     CPPUNIT_ASSERT_EQUAL(OUString("First Page"), 
getProperty<OUString>(xTextContent->getAnchor(), "PageStyleName"));
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf128076, "tdf128076.docx")
+{
+    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> 
xFieldsAccess(xTextFieldsSupplier->getTextFields());
+    uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
+
+    if( !xFields->hasMoreElements() ) {
+        CPPUNIT_ASSERT(false);
+        return;
+    }
+
+    uno::Reference<text::XTextField> 
xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("User Field adres = Test"), 
xEnumerationAccess->getPresentation(true).trim());
+    CPPUNIT_ASSERT_EQUAL(OUString("Test"), 
xEnumerationAccess->getPresentation(false).trim());
+}
+
 DECLARE_OOXMLIMPORT_TEST(testfdo90720, "testfdo90720.docx")
 {
     uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 0cbf59a13931..c8363b9c01f9 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1186,11 +1186,11 @@ public:
 
     SwFieldType* GetFieldType() const
     {
-        if(!m_pDoc)
+        if(!m_pDoc && !IsDescriptor())
             throw uno::RuntimeException();
-
-        if (IsDescriptor())
+        else if (IsDescriptor())
             return m_pFieldType;
+
         return m_pFormatField->GetField()->GetTyp();
     }
     void SetFieldType(SwFieldType& rType)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to