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

New commits:
commit 53abdbd6011116ca9e1e03ad2bb5a72eb0bae7f8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue May 27 17:25:52 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue May 27 21:29:13 2025 +0200

    null deref of SwTextNode
    
     #0  rtl::OUString::getLength (this=<optimized out>) at 
include/rtl/ustring.hxx:821
     #1  SwTextNode::Len (this=this@entry=0x0) at 
sw/source/core/txtnode/ndtxt.cxx:300
     #2  0x00007fe9a0a80b0d in SwCursor::LeftRight(bool, unsigned short, 
SwCursorSkipMode, bool, bool, bool, SwRootFrame const*, bool) ()
         at sw/source/core/crsr/swcrsr.cxx:1789
     #3  0x00007fe9a0a552d4 in SwCursorShell::LeftRight(bool, unsigned short, 
SwCursorSkipMode, bool) ()
         at sw/inc/crsrsh.hxx:495
     #4  0x00007fe9a0c82eca in SwCursorShell::Right (bAllowVisual=false, 
nMode=SwCursorSkipMode::Chars, nCnt=1, this=0x361e17e0)
         at sw/inc/crsrsh.hxx:379
     #5  SwEditShell::SetExtTextInputData(CommandExtTextInputData const&) ()
         at sw/source/core/edit/editsh.cxx:1019
     #6  0x00007fe9a13e7dad in SwEditWin::Command(CommandEvent const&) ()
         at sw/source/uibase/docvw/edtwin.cxx:5932
     #7  0x00007fe9b02806fb in ImplCallCommand(VclPtr<vcl::Window> const&, 
CommandEventId, void const*, bool, Point const*) ()
         at include/rtl/ref.hxx:203
     #8  0x00007fe9b0285bb1 in ImplHandleExtTextInput (nCursorFlags=<optimized 
out>, nCursorPos=<optimized out>, pTextAttr=<optimized out>, rText=..., 
pWindow=<optimized out>)
         at include/vcl/vclreferencebase.hxx:37
     #9  ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) () at 
vcl/source/window/winproc.cxx:2855
     #10 0x00007fe9b0271355 in vcl::Window::PostExtTextInputEvent(VclEventId, 
rtl::OUString const&) ()
         at vcl/source/window/window.cxx:2098
     #11 0x00007fe9af195bd9 in (anonymous namespace)::LOKPostAsyncEvent(void*, 
void*) ()
         at sfx2/source/view/lokhelper.cxx:1209
    
    Change-Id: I4f1699b8ed7a7797d6dfabc05c500370c24e0976
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185930
    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 345d6a213d12..ead85e10bfd0 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1785,8 +1785,8 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
SwCursorSkipMode nMode,
         if (!bLeft && pLayout && pLayout->GetFieldmarkMode() == 
sw::FieldmarkMode::ShowResult)
         {
             SwTextNode const*const pNode(GetPoint()->GetNode().GetTextNode());
-            assert(pNode);
-            if (pNode->Len() != GetPoint()->GetContentIndex()
+            SAL_WARN_IF(!pNode, "sw.core", "expected a SwTextNode");
+            if (pNode && pNode->Len() != GetPoint()->GetContentIndex()
                 && pNode->GetText()[GetPoint()->GetContentIndex()] == 
CH_TXT_ATR_FIELDSTART)
             {
                 IDocumentMarkAccess const& 
rIDMA(*GetDoc().getIDocumentMarkAccess());

Reply via email to