sw/source/uibase/shells/tabsh.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 184a5a6453146ec15e63c649c383abceb8743599
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Aug 7 19:59:47 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Aug 8 20:03:29 2025 +0200

    crashreporting: check Lower()
    
    See 
https://crashreport.libreoffice.org/stats/signature/SwTableShell::GetState(SfxItemSet%20&)
    which is new in 25.8 after
    
    commit 1b03f6ea0362a38c6c4e5e767fcb5cf87ddd28dd
    Author: Ujjawal Kumar <randomfores...@gmail.com>
    Date:   Thu Mar 13 20:42:21 2025 +0530
    
        tdf#149825 Add command to insert a paragraph break before table
    
    I couldn't find a way to reproduce it but Lower() might return
    nullptr as it uses SAL_RET_MAYBENULL. why the MSVC Analyzer
    didn't flag it is a mistery to me though
    
    Change-Id: I3002ee170009cd460f3a9792c5b95d76ae1ca2ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189129
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 22a4e2df6f521a5baf1abfd9d4bf6da116933ed8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189142
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/source/uibase/shells/tabsh.cxx 
b/sw/source/uibase/shells/tabsh.cxx
index 2283b53c1fe4..76cc764da6dd 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -1554,16 +1554,17 @@ void SwTableShell::GetState(SfxItemSet &rSet)
                     // is the very first item of the document; the command 
should be hidden otherwise
                     SwContentFrame* curFrame = rSh.GetCurrFrame();
                     SwPageFrame* pageFrame = curFrame->FindPageFrame();
-                    SwFrame* frame = pageFrame->Lower();
-
-                    while(!frame->IsContentFrame())
+                    if (SwFrame* frame = pageFrame->Lower())
                     {
-                        frame = frame->GetLower();
-                    }
+                        while(!frame->IsContentFrame())
+                        {
+                            frame = frame->GetLower();
+                        }
 
-                    if(frame->FindTabFrame() != curFrame->FindTabFrame())
-                    {
-                        rSet.DisableItem(nSlot);
+                        if(frame->FindTabFrame() != curFrame->FindTabFrame())
+                        {
+                            rSet.DisableItem(nSlot);
+                        }
                     }
                 }
                 break;

Reply via email to