[Libreoffice-bugs] [Bug 140077] Fatal Error after insert a new line by Enter (std::bad_array_new_length)

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Feb 21 16:14:51 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=140077

--- Comment #10 from Dave Gilbert <freedesktop at treblig.org> ---
Ah, so if I add:

+++ b/sw/source/core/text/porlay.cxx
@@ -2648,17 +2648,24 @@ TextFrameIndex SwScriptInfo::CountCJKCharacters(const
OUString &rText,
     TextFrameIndex nPos, TextFrameIndex const nEnd, LanguageType aLang)
 {
     TextFrameIndex nCount(0);
     if (nEnd > nPos)
     {
         sal_Int32 nDone = 0;
         const lang::Locale &rLocale = g_pBreakIt->GetLocale( aLang );
         while ( nPos < nEnd )
         {
+            TextFrameIndex nOldPos = nPos;
             nPos = TextFrameIndex(g_pBreakIt->GetBreakIter()->nextCharacters(
                     rText, sal_Int32(nPos),
                     rLocale,
                     i18n::CharacterIteratorMode::SKIPCELL, 1, nDone));
+            if (nPos == nOldPos) {
+                SAL_WARN("sw.core", "CountCJKCharacters not moving" );
+                break;
+            }
             nCount++;
         }

then I get the bad_array_new_length back.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210221/bfa565b9/attachment.htm>


More information about the Libreoffice-bugs mailing list