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

Michael Stahl mstahl at redhat.com
Thu Oct 19 12:33:14 UTC 2017


 sw/source/core/txtnode/thints.cxx |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit c79da868c0b02b1b1333c3b805899bb4ce867f6a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Oct 19 14:01:33 2017 +0200

    sw: fix odd condition in SwpHints::MergePortions()
    
    All of the RES_CHRATR_* items are poolable, hence we have
    (pItem1 != pItem2) == (pItem1->Which() != pItem2->Which() || *pItem1 != *pItem2)
    
    Move the redundant check to an assert() so we notice in case
    somebody adds a new non-poolable RES_CHRATR.
    
    Thanks to ccsheller for pointing me to this condition.
    
    Change-Id: I9e0634946b8bede3f483bb8997f69de05beae64c

diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 71fbe12ba888..3d33f5bf1f5a 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2782,10 +2782,9 @@ bool SwpHints::MergePortions( SwTextNode& rNode )
                                  pItem1 = iter1.NextItem(),
                                  pItem2 = iter2.NextItem())
                             {
-                                if (pItem1 != pItem2 ||
-                                    pItem1->Which() != pItem2->Which() ||
-                                    *pItem1 != *pItem2)
+                                if (pItem1 != pItem2) // all are poolable
                                 {
+                                    assert(IsInvalidItem(pItem1) || IsInvalidItem(pItem2) || pItem1->Which() != pItem2->Which() || *pItem1 != *pItem2);
                                     eMerge = DIFFER;
                                     break;
                                 }


More information about the Libreoffice-commits mailing list