sw/inc/ndtxt.hxx | 2 +- sw/source/core/fields/reffld.cxx | 4 ++-- sw/source/core/txtnode/ndtxt.cxx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-)
New commits: commit bcaded18437e2421de2011d24e5d611af4e1ddf3 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Dec 15 12:16:35 2021 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Wed Dec 22 05:57:39 2021 +0100 tdf#139843 sw_redlinehide: fix crash while updating reference fields Use layout in MakeRefNumStr() when checking if node is numbered, because a hidden node has a null SwNodeNum. (regression from ae246b44da1708417aaaefe4f9186cfbbb9a9137) Change-Id: Iea797c03018929601ea797f00e3cf2d7749e55ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126857 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit cc02c0e32fda654cb4bcb93f87ceb48b356e1d84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126876 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit 0d05c7a566f0fd9660c48b3efb74d3c3d969226d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126970 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 9b7de4e89cb7..54db3b1523cb 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -510,7 +510,7 @@ public: @retval true This text node has a number. @retval false else */ - bool HasNumber() const; + bool HasNumber(SwRootFrame const* pLayout = nullptr) const; /** Returns if this text node has a bullet. diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 2340c1313d0f..20ab617a8fd1 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -768,7 +768,7 @@ static std::pair<OUString, bool> MakeRefNumStr( SwTextNode const& rTextNodeOfReferencedItem(pLayout ? *sw::GetParaPropsNode(*pLayout, i_rTextNodeOfReferencedItem) : i_rTextNodeOfReferencedItem); - if ( rTextNodeOfReferencedItem.HasNumber() && + if ( rTextNodeOfReferencedItem.HasNumber(pLayout) && rTextNodeOfReferencedItem.IsCountedInList() ) { OSL_ENSURE( rTextNodeOfReferencedItem.GetNum(pLayout), @@ -792,7 +792,7 @@ static std::pair<OUString, bool> MakeRefNumStr( == rTextNodeOfReferencedItem.FindFooterStartNode() ) { const SwNodeNum* pNodeNumForTextNodeOfField( nullptr ); - if ( rTextNodeOfField.HasNumber() && + if ( rTextNodeOfField.HasNumber(pLayout) && rTextNodeOfField.GetNumRule() == rTextNodeOfReferencedItem.GetNumRule() ) { pNodeNumForTextNodeOfField = rTextNodeOfField.GetNum(pLayout); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index a0cc7337baa1..09c897478f50 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3076,11 +3076,11 @@ sal_uInt16 lcl_BoundListLevel(const int nActualLevel) } // -> #i29560# -bool SwTextNode::HasNumber() const +bool SwTextNode::HasNumber(SwRootFrame const*const pLayout) const { bool bResult = false; - const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr; + const SwNumRule *const pRule = GetNum(pLayout) ? GetNum(pLayout)->GetNumRule() : nullptr; if ( pRule ) { const SwNumFormat& aFormat(pRule->Get(lcl_BoundListLevel(GetActualListLevel())));