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

Eike Rathke erack at redhat.com
Tue Feb 28 12:51:14 UTC 2017


 sc/source/core/data/postit.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 041a9b641bac500b7b4bbff1280b9d311ae2dbcb
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Feb 28 13:47:54 2017 +0100

    assert that nullptr captions are not in a list
    
    Change-Id: I0c286891454d290ec4373dbc37e31d65c22c746d

diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index e7004e7..b0e736b 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -494,6 +494,8 @@ ScCaptionPtr& ScCaptionPtr::operator=( const ScCaptionPtr& r )
     // Let's find some weird usage.
     // Assigning without head doesn't make sense unless it is a nullptr caption.
     assert(r.mpHead || !r.mpCaption);
+    // A nullptr caption must not be in a list and thus not have a head.
+    assert(!r.mpHead || r.mpCaption);
     // Same captions were caught above, so here different heads must be present.
     assert(r.mpHead != mpHead);
 
@@ -533,7 +535,7 @@ void ScCaptionPtr::removeFromList()
         // Use the walk to check consistency on the fly.
         assert(pThat->mpHead == mpHead);            // all belong to the same
         assert(pThat->mpHead || !pThat->mpNext);    // next without head is bad
-        assert(pThat->mpCaption == nullptr || pThat->mpCaption == mpCaption);
+        assert(pThat->mpCaption == mpCaption);
         pThat = pThat->mpNext;
 #if OSL_DEBUG_LEVEL > 0
         ++nCount;
@@ -556,7 +558,7 @@ void ScCaptionPtr::removeFromList()
         {
             assert(pThat->mpHead == mpHead);            // all belong to the same
             assert(pThat->mpHead || !pThat->mpNext);    // next without head is bad
-            assert(pThat->mpCaption == nullptr || pThat->mpCaption == mpCaption);
+            assert(pThat->mpCaption == mpCaption);
             ++nCount;
         }
         while ((pThat = pThat->mpNext) != nullptr);


More information about the Libreoffice-commits mailing list