diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-07-15 16:44:37 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-07-17 17:48:25 +0200 |
commit | ca2dfac3e790fb384e904502fe1ededd695001af (patch) | |
tree | 9ec89aeee2da63a9c5c277837946af2206f65ced /sw/source/core/unocore | |
parent | ba4bc66301e0cb30379f19b9c19e320a533daa42 (diff) |
sw: fix crash when using anchor of at-paragraph fly ...
... to insert fieldmark; the problem is that the anchor doesn't have
SwIndex so the resulting sw::mark::Fieldmark's positions won't have
SwIndex either, so they aren't updated when its dummy chars are inserted
in lcl_SetFieldMarks().
Change-Id: Id6281f45aa1f1337f1ae599877f155b129389d81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98852
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw/source/core/unocore')
-rw-r--r-- | sw/source/core/unocore/unodraw.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 5e3ec6b23d37..d21756c65720 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -2068,7 +2068,14 @@ uno::Reference< text::XTextRange > SwXShape::getAnchor() (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum())) { const SwPosition &rPos = *(pFormat->GetAnchor().GetContentAnchor()); - aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA) + { // ensure that SwXTextRange has SwIndex + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), SwPosition(rPos.nNode), nullptr); + } + else + { + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + } } } else diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index dcb6d0ede363..c277d1179789 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2641,7 +2641,14 @@ uno::Reference< text::XTextRange > SwXFrame::getAnchor() (rAnchor.GetContentAnchor() && !rAnchor.GetPageNum())) { const SwPosition &rPos = *(rAnchor.GetContentAnchor()); - aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + if (rAnchor.GetAnchorId() == RndStdIds::FLY_AT_PARA) + { // ensure that SwXTextRange has SwIndex + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), SwPosition(rPos.nNode), nullptr); + } + else + { + aRef = SwXTextRange::CreateXTextRange(*pFormat->GetDoc(), rPos, nullptr); + } } return aRef; |