summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2022-05-25 23:17:02 -0800
committerJim Raykowski <raykowj@gmail.com>2022-05-27 09:06:47 +0200
commitba0a713fe76da5ee40ad34b375d3a900bff4e01a (patch)
tree93bf3f1e78b87543e970d271b4900de925736665
parent4b5de4684fab255a1a69ecab9ece0384947a29c4 (diff)
tdf#149268 avoid null pointer dereference
Change-Id: Iff3aece9eaed40c31764616504f1a4229db57e01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134978 Tested-by: Jenkins Tested-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-by: Jim Raykowski <raykowj@gmail.com>
-rw-r--r--sw/source/uibase/utlui/content.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index 91ce874b1553..584b80dfe0c5 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -651,15 +651,13 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
SwPosition bPos(bTextNode, b->GetStart());
// use anchor position for entries that are located in flys
if (nEndOfExtrasIndex >= aTextNode.GetIndex())
- {
if (auto pFlyFormat = aTextNode.GetFlyFormat())
- aPos = *pFlyFormat->GetAnchor().GetContentAnchor();
- }
+ if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor())
+ aPos = *pPos;
if (nEndOfExtrasIndex >= bTextNode.GetIndex())
- {
if (auto pFlyFormat = bTextNode.GetFlyFormat())
- bPos = *pFlyFormat->GetAnchor().GetContentAnchor();
- }
+ if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor())
+ bPos = *pPos;
return aPos < bPos;});
}
}
@@ -856,15 +854,13 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
SwPosition bPos(const_cast<SwTextNode&>(bTextNode), b->rINetAttr.GetStart());
// use anchor position for entries that are located in flys
if (nEndOfExtrasIndex >= aTextNode.GetIndex())
- {
if (auto pFlyFormat = aTextNode.GetFlyFormat())
- aPos = *pFlyFormat->GetAnchor().GetContentAnchor();
- }
+ if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor())
+ aPos = *pPos;
if (nEndOfExtrasIndex >= bTextNode.GetIndex())
- {
if (auto pFlyFormat = bTextNode.GetFlyFormat())
- bPos = *pFlyFormat->GetAnchor().GetContentAnchor();
- }
+ if (const SwPosition* pPos = pFlyFormat->GetAnchor().GetContentAnchor())
+ bPos = *pPos;
return aPos < bPos;});
}