summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-12-10 17:04:59 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-12-11 20:51:22 +0100
commita60f4a6222fdbcb4a1adebe670eaf1636a014da6 (patch)
tree247ac9f8ff769e15329a5416bdc8c17725ca5ba5
parenttdf#76644 extended tips not shown for 'gen' menu items (diff)
downloadcore-a60f4a6222fdbcb4a1adebe670eaf1636a014da6.tar.gz
core-a60f4a6222fdbcb4a1adebe670eaf1636a014da6.zip
sw: add missing nullptr check
introduced by 0aa0fda64057647219954480ac1bab86b0f0e433 See: https://crashreport.libreoffice.org/stats/signature/SwCursor::UpDown(bool,unsigned%20short,Point%20const%20*,long,SwRootFrame%20&) Change-Id: Ifb7a86b0dfd1477d6ffa15c7d4d3289984747f87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107561 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 0a80dcad342c1be71f467e46a0cf4f5dd1259056) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107615 Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/crsr/swcrsr.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index e1237d8cffab..879d632dfc8b 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2044,9 +2044,15 @@ bool SwCursor::UpDown( bool bUp, sal_uInt16 nCnt,
}
else
{
+ sal_Int32 nOffset = 0;
+
// Jump to beginning or end of line when the cursor at first or last line.
- SwNode& rNode = GetPoint()->nNode.GetNode();
- const sal_Int32 nOffset = bUp ? 0 : rNode.GetTextNode()->GetText().getLength();
+ if(!bUp)
+ {
+ SwTextNode* pTextNd = GetPoint()->nNode.GetNode().GetTextNode();
+ if (pTextNd)
+ nOffset = pTextNd->GetText().getLength();
+ }
const SwPosition aPos(*GetContentNode(), nOffset);
//if cursor has already been at start or end of file,