summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-05-02 09:11:25 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-05-02 08:56:47 +0200
commit0d82ddb39e0cdbfde428eb4da7268cac4176f1bd (patch)
tree5f7bba1740b96507324d28cb380eb7be2f561522 /sw/source
parent687ae6ca01177a04f9ea715a1f1cd70f385a0840 (diff)
tdf#160898: check for nullptr
Regression after commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda (tdf#154877 sw: generalise ExtendedSelectAll(), 2023-05-09) Change-Id: I9289171647fca8bd1b696399ff7c43a2ac7b8b30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166990 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 58396b6f2890..d3b39a4ae2c4 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -737,9 +737,15 @@ bool SwCursorShell::MoveStartText()
SwTableNode const*const pTable(pStartNode->FindTableNode());
m_pCurrentCursor->GetPoint()->Assign(*pStartNode);
SwNodes::GoNext(m_pCurrentCursor->GetPoint());
- while (m_pCurrentCursor->GetPoint()->GetNode().FindTableNode() != pTable
- && (!pTable || pTable->GetIndex() < m_pCurrentCursor->GetPoint()->GetNode().FindTableNode()->GetIndex())
- && MoveOutOfTable());
+ while (auto* pFoundTable = m_pCurrentCursor->GetPoint()->GetNode().FindTableNode())
+ {
+ if (pFoundTable == pTable)
+ break;
+ if (pTable && pTable->GetIndex() >= pFoundTable->GetIndex())
+ break;
+ if (!MoveOutOfTable())
+ break;
+ }
UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY);
return old != *m_pCurrentCursor->GetPoint();
}