sw/source/core/crsr/swcrsr.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
New commits: commit 40b7e8671779f94894ce2bd4e7eb9b5d41d48c6e Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Mon May 12 19:39:26 2025 +0930 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Mon May 12 14:19:26 2025 +0200 sw: reduce nested levels in GetTextFrame Change-Id: I4bc43382e60daf3d47770c7c24eb2440b1fecaa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185205 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 0be9e3ba80a9..345d6a213d12 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1736,19 +1736,19 @@ SwCursor::DoSetBidiLevelLeftRight( static const SwTextFrame* GetTextFrame(const SwNode& rNode, SwRootFrame const*const pLayout) { - SwContentFrame const* pFrame(nullptr); - if (pLayout) + if (!pLayout) + return nullptr; + + SwContentFrame const* pFrame(rNode.GetContentNode()->getLayoutFrame(pLayout)); + if (!pFrame) + return nullptr; + + while (pFrame->GetPrecede()) { - pFrame = rNode.GetContentNode()->getLayoutFrame(pLayout); - if (pFrame) - { - while (pFrame->GetPrecede()) - { - pFrame = static_cast<SwContentFrame const*>(pFrame->GetPrecede()); - } - } + pFrame = static_cast<SwContentFrame const*>(pFrame->GetPrecede()); } - return pFrame ? pFrame->DynCastTextFrame() : nullptr; + + return pFrame->DynCastTextFrame(); } bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode,