summaryrefslogtreecommitdiff
path: root/sw/source/core/objectpositioning
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-04-27 20:48:30 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-04-28 09:03:18 +0200
commit4ba1909f12b49f020195b5e767045340717ce6df (patch)
tree12ba92e913c321cc0ca0421c9dcf87879819177c /sw/source/core/objectpositioning
parent7cfc983f8f3f4d094cd01128043d5e2021cb80c6 (diff)
tdf#131729 sw: handle no drawing objects when calculating overlap of objects
Regression from commit d37096f59e7e0286e55008153591a60bab92b9e8 (Related: tdf#124600 sw anchored object allow overlap: add layout, 2019-09-19), we assumed that the anchor frame always has draw objects, but that may not be the case. That happens when dragging a to-character anchored object around, before the object is added to its anchor. Change-Id: I1271a6e498553838c3851864b7965a1ba28de663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92989 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core/objectpositioning')
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index fd4193918171..3c40f3b91aef 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -1112,8 +1112,13 @@ void SwToContentAnchoredObjectPosition::CalcOverlap(const SwTextFrame* pAnchorFr
}
// Get the list of objects.
- const SwSortedObjs& rSortedObjs = *pAnchorFrameForVertPos->GetDrawObjs();
- for (const auto& pAnchoredObj : rSortedObjs)
+ auto pSortedObjs = pAnchorFrameForVertPos->GetDrawObjs();
+ if (!pSortedObjs)
+ {
+ return;
+ }
+
+ for (const auto& pAnchoredObj : *pSortedObjs)
{
if (pAnchoredObj == &GetAnchoredObj())
{