sc/source/ui/view/cellsh1.cxx  |    6 +++---
 sw/source/uibase/app/docst.cxx |    4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit b9101796485f301b9c382629de9aaa24e1d1091b
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Jan 20 17:26:24 2025 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jan 22 13:21:47 2025 +0100

    tdf#164722: fix the "contains conditional format" condition
    
    In commit a06a44c3b342648139e7fa0ff850a4176df60538 (one more fix for
    fdo#58686, 2012-12-25), the code was adjusted for possible nullptrs
    in the conditional format list. The new bContainsExistingCondFormat
    variable meant "there is at least one non-nullptr element in list",
    and was used as a condition for deciding which dialog to show (and
    the pre-existing bContainsCondFormat variable was used to decide if
    iterating the list is necessary).
    
    But the two similar variables resulted in confusion; eventually, in
    commit 2b5915da481990fd6ea272104215d82b6fbf5dbb (tdf#60573 Conditional
    formatting does not allow scrolling, 2015-05-12), bContainsCondFormat
    was misused in a condition to show the dialog.
    
    Commit c492de66a077f3a2a960209b0b8b278b3901f361 (tdf#160149: save
    and restore the whole set of tab's conditional formats, 2024-03-17),
    nullptrs became possible in one more scenario (which is OK), but
    that uncovered the wrong variable use here.
    
    To avoid further confusion, merge the two variables into one, i.e.
    update bContainsCondFormat in the loop over the list - so that we
    only have one "contains conditional format" variable with up-to-date
    information.
    
    Change-Id: I567dc97551fba748bf6f2242d4650442f4753cc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180507
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 9916469fa9ff48340cfe317269f259b50e4ecd21)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180526
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index 4b94a67eed1a..3e1ca33cf55c 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -2245,9 +2245,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                 const ScCondFormatIndexes& rCondFormats = 
pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
                 bool bContainsCondFormat = !rCondFormats.empty();
                 bool bCondFormatDlg = false;
-                bool bContainsExistingCondFormat = false;
                 if(bContainsCondFormat)
                 {
+                    bContainsCondFormat = false; // maybe all nullptrs?
                     for (const auto& rCondFormat : rCondFormats)
                     {
                         // check if at least one existing conditional format 
has the same range
@@ -2255,7 +2255,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
                         if(!pCondFormat)
                             continue;
 
-                        bContainsExistingCondFormat = true;
+                        bContainsCondFormat = true; // found at least one 
format
                         const ScRangeList& rCondFormatRange = 
pCondFormat->GetRange();
                         if(rCondFormatRange == aRangeList)
                         {
@@ -2426,7 +2426,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
 
                 // if not found a conditional format ask whether we should 
edit one of the existing
                 // or should create a new overlapping conditional format
-                if(bContainsCondFormat && !bCondFormatDlg && 
bContainsExistingCondFormat)
+                if (bContainsCondFormat && !bCondFormatDlg)
                 {
                     std::shared_ptr<weld::MessageDialog> 
xQueryBox(Application::CreateMessageDialog(pTabViewShell->GetFrameWeld(),
                                                                    
VclMessageType::Question, VclButtonsType::YesNo,
commit 5f8f5bb50289b295b24b464f57b6aad2386a5ed7
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Jan 16 15:59:14 2025 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Wed Jan 22 13:21:34 2025 +0100

    crashtesting: Find might return nullptr
    
    Since
    commit 7a35f3dc7419d833b8f47069c4df63e900ccb880
    Author: László Németh <nem...@numbertext.org>
    Date:   Fri Oct 25 00:38:35 2024 +0200
    
        tdf#48459 sw inline heading: apply it on the selected words
    
    Seen in 
https://crashreport.libreoffice.org/stats/crash_details/5629bae3-8c43-4864-8758-4887b00a892d
    
    Change-Id: I125304700b4e2fcc4ecc52eb7eaecea049cbb5ee
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180356
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 51e4b6b126dc90e0725b9a94dfca8ee87f3e2d3b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180362
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index c9b9a74d730c..1fe54effc43b 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1210,7 +1210,9 @@ bool SwDocShell::MakeInlineHeading(SwWrtShell *pSh, 
SwTextFormatColl* pColl, con
             // use the associated borderless frame style "Inline Heading"
             SwDocStyleSheet* pStyle2 = static_cast<SwDocStyleSheet*>(
                             m_xBasePool->Find( "Inline Heading", 
SfxStyleFamily::Frame));
-            pSh->SetFrameFormat( pStyle2->GetFrameFormat() );
+            SAL_WARN_IF( !pStyle2, "sw.ui", "Style not found" );
+            if(pStyle2)
+                pSh->SetFrameFormat( pStyle2->GetFrameFormat() );
 
             // select the text content of the frame, and apply the paragraph 
style
             pSh->UnSelectFrame();

Reply via email to