summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-02-28 13:47:54 +0100
committerEike Rathke <erack@redhat.com>2017-02-28 13:50:44 +0100
commit041a9b641bac500b7b4bbff1280b9d311ae2dbcb (patch)
treebeaa0ee34e00fe13921f0528feb72ea723afa5b4 /sc
parent214ef61b37c7e05414fa975bd21643220f2d4140 (diff)
assert that nullptr captions are not in a list
Change-Id: I0c286891454d290ec4373dbc37e31d65c22c746d
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/postit.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index e7004e7835e6..b0e736be755b 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);