[Libreoffice-commits] core.git: writerfilter/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Wed Jul 4 17:10:08 UTC 2018


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 99d2c655012af86941f2cdc46fc555bcc27c8eba
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sat Jun 30 20:34:46 2018 +0200

    cppcheck: variableScope
    
    Change-Id: I9a01758812e5611c313a41225ec8e04b86e3bdf3
    Reviewed-on: https://gerrit.libreoffice.org/56769
    Tested-by: Jenkins
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8445b5c9a292..fca227d9a702 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -475,8 +475,6 @@ RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms const& rSprms, Id
     auto it = m_aStyleTableEntries.find(nStyle);
     if (it != m_aStyleTableEntries.end())
     {
-        RTFReferenceProperties& rProps = *static_cast<RTFReferenceProperties*>(it->second.get());
-
         // cloneAndDeduplicate() wants to know about only a single "style", so
         // let's merge paragraph and character style properties here.
         auto itChar = m_aStyleTableEntries.end();
@@ -490,15 +488,21 @@ RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms const& rSprms, Id
         RTFSprms aStyleAttributes;
         // Ensure the paragraph style is a flat list.
         if (!nStyleType || nStyleType == NS_ooxml::LN_Value_ST_StyleType_paragraph)
+        {
+            RTFReferenceProperties& rProps
+                = *static_cast<RTFReferenceProperties*>(it->second.get());
             lcl_copyFlatten(rProps, aStyleAttributes, aStyleSprms);
+        }
 
         if (itChar != m_aStyleTableEntries.end())
         {
             // Found active character style, then update aStyleSprms/Attributes.
-            RTFReferenceProperties& rCharProps
-                = *static_cast<RTFReferenceProperties*>(itChar->second.get());
             if (!nStyleType || nStyleType == NS_ooxml::LN_Value_ST_StyleType_character)
+            {
+                RTFReferenceProperties& rCharProps
+                    = *static_cast<RTFReferenceProperties*>(itChar->second.get());
                 lcl_copyFlatten(rCharProps, aStyleAttributes, aStyleSprms);
+            }
         }
 
         // Get rid of direct formatting what is already in the style.


More information about the Libreoffice-commits mailing list