sw/source/core/txtnode/thints.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9193e61d3e7b850b3715c848c09434e24855340b
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Mon Jan 22 15:22:39 2024 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Jan 22 16:56:43 2024 +0100

    tdf#106733 sw: fix bad downcast in SwTextNode::GetLang()
    
    Fix bad cast of SvxNoHyphenItem to SvxLanguageItem
    reported by <https://ci.libreoffice.org/job/lo_ubsan/3049/>:
    
      /sw/source/core/txtnode/thints.cxx:3560:16: runtime error: downcast of 
address 0x6030005e44d0 which does not point to an object of type 'const 
SvxLanguageItem'
      0x6030005e44d0: note: object is of type 'SvxNoHyphenItem'
       1a 00 00 00  90 e3 d5 77 5c 7f 00 00  00 00 00 00 13 00 be be  16 00 00 
00 92 01 be be  00 00 00 00
                    ^~~~~~~~~~~~~~~~~~~~~~~
                    vptr for 'SvxNoHyphenItem'
          #0 0x7f5bda7e8c0c in SwTextNode::GetLang(int, int, unsigned short, 
bool) const /sw/source/core/txtnode/thints.cxx:3560:16
    
    Regression since commit b5e275f47a54bd7fee39dad516a433fde5be872d
    "tdf#106733 sw: implement CharNoHyphenation".
    
    Change-Id: I0c6f60a4074f8fd6da26674cace47f5c5e32afd6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162401
    Tested-by: Jenkins
    Reviewed-by: László Németh <nem...@numbertext.org>

diff --git a/sw/source/core/txtnode/thints.cxx 
b/sw/source/core/txtnode/thints.cxx
index 184866daf3e0..5b78ea29eb84 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -3555,7 +3555,7 @@ LanguageType SwTextNode::GetLang( const sal_Int32 nBegin, 
const sal_Int32 nLen,
             }
         }
     }
-    if( LANGUAGE_DONTKNOW == nRet )
+    if( LANGUAGE_DONTKNOW == nRet && !bNoneIfNoHyphenation )
     {
         nRet = static_cast<const SvxLanguageItem&>(GetSwAttrSet().Get( 
nWhichId )).GetLanguage();
         if( LANGUAGE_DONTKNOW == nRet )

Reply via email to