[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - xmloff/source

Caolán McNamara caolanm at redhat.com
Tue Jul 28 08:47:45 PDT 2015


 xmloff/source/text/txtexppr.cxx |   43 +++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 18 deletions(-)

New commits:
commit 8a44b45a77730b56a575dfa13883d8d0053914c1
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 24 15:48:25 2015 +0100

    Resolves: tdf#91950 optional entries may not be present
    
    here we appear to check if the preceding optional entries are of certain
    types. Presumably if they are optional then its legal for them not to
    exist at all, just that if they are there they should be in the right
    order.
    
    Change-Id: Id147b91d7d375d7985d901cda112c7757dc3fb19
    Reviewed-on: https://gerrit.libreoffice.org/17354
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 46948b2..400711e 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -70,35 +70,42 @@ void XMLTextExportPropertySetMapper::handleElementItem(
 
     case CTF_BACKGROUND_URL:
         {
-            assert(pProperties && nIdx >= 3);
             const Any *pPos = 0, *pFilter = 0, *pTrans = 0;
             sal_uInt32 nPropIndex = rProperty.mnIndex;
 
             // these are all optional, so have to check them in order
             // note: this index order dependency is a steaming pile of manure
-            sal_uInt32 nIndex(nIdx - 1);
-            const XMLPropertyState& rFilter = (*pProperties)[nIndex];
-            if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
-                    ->GetEntryContextId(rFilter.mnIndex))
+            if (nIdx)
             {
-                pFilter = &rFilter.maValue;
-                --nIndex;
+                const XMLPropertyState& rFilter = (*pProperties)[nIdx - 1];
+                if (CTF_BACKGROUND_FILTER == getPropertySetMapper()
+                        ->GetEntryContextId(rFilter.mnIndex))
+                {
+                    pFilter = &rFilter.maValue;
+                    --nIdx;
+                }
             }
 
-            const XMLPropertyState& rPos = (*pProperties)[nIndex];
-            if (CTF_BACKGROUND_POS == getPropertySetMapper()
-                    ->GetEntryContextId(rPos.mnIndex))
+            if (nIdx)
             {
-                pPos = &rPos.maValue;
-                --nIndex;
+                const XMLPropertyState& rPos = (*pProperties)[nIdx - 1];
+                if (CTF_BACKGROUND_POS == getPropertySetMapper()
+                        ->GetEntryContextId(rPos.mnIndex))
+                {
+                    pPos = &rPos.maValue;
+                    --nIdx;
+                }
             }
 
-            const XMLPropertyState& rTrans = (*pProperties)[nIndex];
-            // #99657# transparency may be there, but doesn't have to be.
-            // If it's there, it must be in the right position.
-            if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
-                  ->GetEntryContextId( rTrans.mnIndex ) )
-                pTrans = &rTrans.maValue;
+            if (nIdx)
+            {
+                const XMLPropertyState& rTrans = (*pProperties)[nIdx - 1];
+                // #99657# transparency may be there, but doesn't have to be.
+                // If it's there, it must be in the right position.
+                if( CTF_BACKGROUND_TRANSPARENCY == getPropertySetMapper()
+                      ->GetEntryContextId( rTrans.mnIndex ) )
+                    pTrans = &rTrans.maValue;
+            }
 
             pThis->maBackgroundImageExport.exportXML(
                     rProperty.maValue, pPos, pFilter, pTrans,


More information about the Libreoffice-commits mailing list