[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/source

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 11 16:48:04 UTC 2020


 sw/source/core/crsr/swcrsr.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 7de00f7e26a1b04a9867d6abc86ee88177ebdf1a
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Dec 10 17:04:59 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Dec 11 17:47:31 2020 +0100

    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 at collabora.com>
    (cherry picked from commit 0a80dcad342c1be71f467e46a0cf4f5dd1259056)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107614
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

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,


More information about the Libreoffice-commits mailing list