sw/source/core/text/txtcache.cxx |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 5cdefeef2a079430fc32bace349bdc53ab740779
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Aug 20 09:39:22 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Aug 20 14:54:46 2025 +0200

    Resolves: tdf#168017 fix a crash loading some documents
    
    a problem since:
    
    commit 6e870c040bb0f550c126f0fdeb2b9cd497658dd0
    Date:   Thu Aug 7 21:30:15 2025 +0100
    
        expand default argument of unusual SetPara method
    
    SetPara depended on a previous GetPara to reset its
    cache state on a missing Para to function correctly.
    
    Change-Id: I0952a428dd555514f89f89798f041393eb69e4e9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189956
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/core/text/txtcache.cxx b/sw/source/core/text/txtcache.cxx
index 8a7470030f29..4a0d226838ec 100644
--- a/sw/source/core/text/txtcache.cxx
+++ b/sw/source/core/text/txtcache.cxx
@@ -137,22 +137,23 @@ std::unique_ptr<SwParaPortion> 
SwTextFrame::SetPara(std::unique_ptr<SwParaPortio
                                         Get( this, GetCacheIdx(), false ));
         if ( pTextLine )
         {
-            xOld = pTextLine->SetPara(std::move(xNew));
+            return pTextLine->SetPara(std::move(xNew));
         }
         else
         {
-            OSL_ENSURE( !xNew, "+SetPara: Losing SwParaPortion" );
             mnCacheIndex = USHRT_MAX;
         }
     }
-    else if (xNew)
-    {   // Insert a new one
+
+    if (xNew)
+    {
+        // Insert a new one
         SwTextLine *pTextLine = new SwTextLine(this, std::move(xNew));
         if (SwTextFrame::GetTextCache()->Insert(pTextLine, false))
             mnCacheIndex = pTextLine->GetCachePos();
         else
         {
-            OSL_FAIL( "+SetPara: InsertCache failed." );
+            OSL_FAIL("+SetPara: InsertCache failed, Losing SwParaPortion.");
         }
     }
 

Reply via email to