Author: orw
Date: Mon Apr  7 08:12:34 2014
New Revision: 1585426

URL: http://svn.apache.org/r1585426
Log:
124607: ODF import: check on certain property existence in annotation import to 
avoid exceptions

        cherry-picked from trunk


Modified:
    openoffice/branches/AOO410/   (props changed)
    openoffice/branches/AOO410/main/   (props changed)
    openoffice/branches/AOO410/main/xmloff/source/text/txtfldi.cxx

Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
  Merged /openoffice/trunk:r1585261

Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
  Merged /openoffice/trunk/main:r1585261

Modified: openoffice/branches/AOO410/main/xmloff/source/text/txtfldi.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/xmloff/source/text/txtfldi.cxx?rev=1585426&r1=1585425&r2=1585426&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/xmloff/source/text/txtfldi.cxx (original)
+++ openoffice/branches/AOO410/main/xmloff/source/text/txtfldi.cxx Mon Apr  7 
08:12:34 2014
@@ -3760,13 +3760,17 @@ void XMLAnnotationImportContext::EndElem
                 uno::Reference<container::XEnumeration> 
xFields(xFieldsAccess->createEnumeration());
                 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::XPropertySet > 
xCurrField(xFields->nextElement(), uno::UNO_QUERY);
+                    uno::Reference< beans::XPropertySetInfo > 
xCurrFieldPropInfo = xCurrField->getPropertySetInfo();
+                    if ( xCurrFieldPropInfo->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;
+                        }
                     }
                 }
             }


Reply via email to