sw/source/uibase/docvw/edtwin2.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit ac4061b54c774e00e52bb5706f43e455459511bf
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jun 23 11:56:46 2025 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 1 09:10:04 2025 +0200

    tdf#167165: check if node allows creating SwXTextRange
    
    Avoids warnings in debug console:
    
      warn:sw.core:23908:27188:sw/source/core/doc/docbm.cxx:590: 
MarkManager::makeMark(..) - refusing to create mark on non-textnode
      warn:sw.ui:23908:27188:sw/source/uibase/docvw/edtwin2.cxx:476: 
DBG_UNHANDLED_EXCEPTION in RequestHelp
          when: failed to retrieve hyperlink name exception: 
com.sun.star.uno.RuntimeException message: "range has no mark (table?) at 
C:/lo/core/sw/source/core/unocore/unoobj2.cxx:1498"
    
    Change-Id: I6261c402f837668b0851ce736c724ca2bb24d2b4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186810
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit e027fe45486bcdbadb65fa4d3e7be269367150cb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186942
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/docvw/edtwin2.cxx 
b/sw/source/uibase/docvw/edtwin2.cxx
index 0265efc15b10..ef50337c53d0 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -450,6 +450,10 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
 
                     SwPosition aPos(rSh.GetDoc()->GetNodes());
                     rSh.GetLayout()->GetModelPositionForViewPoint(&aPos, aPt);
+                    // Do not try to create a range for non-text and 
non-startnode;
+                    // see MarkManager::makeMark
+                    if (!aPos.GetNode().IsTextNode() && 
!aPos.GetNode().IsStartNode())
+                        break;
                     rtl::Reference<SwXTextRange> 
xRange(SwXTextRange::CreateXTextRange(
                         *(m_rView.GetDocShell()->GetDoc()), aPos, &aPos));
 

Reply via email to