summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2020-12-10 17:04:59 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-11 16:32:25 +0100
commit0a80dcad342c1be71f467e46a0cf4f5dd1259056 (patch)
tree10f175bf8c8748510b7841053eee7b8a2933ebc2 /sw
parente5e3a05f13f47d44276cfe8d88e8ec9d4d559a66 (diff)
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>
Diffstat (limited to 'sw')
-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 4d95fb1b5394..a2c4264f6301 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -2092,9 +2092,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,