xmloff/source/text/txtfldi.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit cf26d7614364176742ae0303efb4499a37ae04c8
Author: Michael Stahl <[email protected]>
Date:   Sat Feb 15 00:24:26 2014 +0100

    fdo#74524: ODF import: fix unhandled exception in annotation import
    
    Crash with unhandled UnknownPropertyException when trying to get "Name"
    property from a PageNumber field.
    
    Change-Id: I501cc138caba034c85630519014b94d783ab8f39

diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 2728f9e..56c9488 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -3716,12 +3716,17 @@ void XMLAnnotationImportContext::EndElement()
                 while (xFields->hasMoreElements())
                 {
                     uno::Reference<beans::XPropertySet> 
xCurrField(xFields->nextElement(), uno::UNO_QUERY);
-                    OUString aFieldName;
-                    xCurrField->getPropertyValue(sPropertyName) >>= aFieldName;
-                    if ( aFieldName == aName )
+                    uno::Reference<beans::XPropertySetInfo> const xInfo(
+                            xCurrField->getPropertySetInfo());
+                    if (xInfo->hasPropertyByName(sPropertyName))
                     {
-                        xPrevField.set( xCurrField, uno::UNO_QUERY );
-                        break;
+                        OUString aFieldName;
+                        xCurrField->getPropertyValue(sPropertyName) >>= 
aFieldName;
+                        if (aFieldName == aName)
+                        {
+                            xPrevField.set( xCurrField, uno::UNO_QUERY );
+                            break;
+                        }
                     }
                 }
             }
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to