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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 17 19:02:19 UTC 2021


 sw/source/core/doc/docnum.cxx |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 7d186c0510b18d12267fc9d930298eadd1cadb8e
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Thu May 13 07:47:09 2021 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Thu Jun 17 21:01:30 2021 +0200

    NFC sw PropagateOutlineRule: early exit if no outlineRule
    
    There is only one outline rule, and we are just getting
    a pointer to it, so there should be no reason why
    this is retrieved for every style defined on the system.
    
    Just get it right at the beginning, and exit if there is none.
    
    Change-Id: I09d122481623dd4667e3f67c5de98164ff106a27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115615
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 95461208e954..9a7740a735e4 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -163,6 +163,10 @@ void SwDoc::SetOutlineNumRule( const SwNumRule& rRule )
 
 void SwDoc::PropagateOutlineRule()
 {
+    SwNumRule* pMyOutlineRule = GetOutlineNumRule();
+    if (!pMyOutlineRule)
+        return;
+
     for (auto pColl : *mpTextFormatCollTable)
     {
         if(pColl->IsAssignedToListLevelOfOutlineStyle())
@@ -172,14 +176,8 @@ void SwDoc::PropagateOutlineRule()
 
             if ( rCollRuleItem.GetValue().isEmpty() )
             {
-                SwNumRule * pMyOutlineRule = GetOutlineNumRule();
-
-                if (pMyOutlineRule)
-                {
-                    SwNumRuleItem aNumItem( pMyOutlineRule->GetName() );
-
-                    pColl->SetFormatAttr(aNumItem);
-                }
+                SwNumRuleItem aNumItem( pMyOutlineRule->GetName() );
+                pColl->SetFormatAttr(aNumItem);
             }
         }
     }


More information about the Libreoffice-commits mailing list