include/svx/sidebar/InspectorTextPanel.hxx            |    4 +--
 svx/source/sidebar/inspector/InspectorTextPanel.cxx   |   23 ++++++++----------
 sw/source/uibase/sidebar/SwPanelFactory.cxx           |    2 -
 sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx |    9 +++----
 sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx |    4 +--
 5 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 412da215c1cb7283b121fa6e9332c3fb2b76a1f4
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Apr 2 08:45:09 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Apr 2 11:24:27 2025 +0200

    cid#1645566 Dereference null return value
    
    Change-Id: I27846372fd28aaba66b726e9838d1e674c2f05be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183612
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Tested-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/include/svx/sidebar/InspectorTextPanel.hxx 
b/include/svx/sidebar/InspectorTextPanel.hxx
index f47babe14c62..2c875dc99d57 100644
--- a/include/svx/sidebar/InspectorTextPanel.hxx
+++ b/include/svx/sidebar/InspectorTextPanel.hxx
@@ -49,9 +49,9 @@ class SVX_DLLPUBLIC InspectorTextPanel
 public:
     virtual ~InspectorTextPanel() override;
 
-    static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent);
+    static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent, 
SfxBindings* pBindings);
 
-    InspectorTextPanel(weld::Widget* pParent);
+    InspectorTextPanel(weld::Widget* pParent, SfxBindings* pBindings);
 
     void updateEntries(const std::vector<TreeNode>& rStore, const sal_Int32 
nParIdx);
 
diff --git a/svx/source/sidebar/inspector/InspectorTextPanel.cxx 
b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
index 190d95f7d4e7..79f718f9eb19 100644
--- a/svx/source/sidebar/inspector/InspectorTextPanel.cxx
+++ b/svx/source/sidebar/inspector/InspectorTextPanel.cxx
@@ -41,22 +41,22 @@ const int MinimumPanelWidth = 250;
 
 namespace svx::sidebar
 {
-std::unique_ptr<PanelLayout> InspectorTextPanel::Create(weld::Widget* pParent)
+std::unique_ptr<PanelLayout> InspectorTextPanel::Create(weld::Widget* pParent,
+                                                        SfxBindings* pBindings)
 {
     if (pParent == nullptr)
         throw lang::IllegalArgumentException(
             u"no parent Window given to InspectorTextPanel::Create"_ustr, 
nullptr, 0);
-    return std::make_unique<InspectorTextPanel>(pParent);
+    return std::make_unique<InspectorTextPanel>(pParent, pBindings);
 }
 
-InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent)
+InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent, SfxBindings* 
pBindings)
     : PanelLayout(pParent, u"InspectorTextPanel"_ustr, 
u"svx/ui/inspectortextpanel.ui"_ustr)
     , mpListBoxStyles(m_xBuilder->weld_tree_view(u"listbox_fonts"_ustr))
-    , nSlotDFStyles(
-          
SfxViewFrame::Current()->GetDispatcher()->GetSlot(".uno:HighlightCharDF")->GetSlotId())
-    , mParaController(SID_SPOTLIGHT_PARASTYLES, 
SfxViewFrame::Current()->GetBindings(), *this)
-    , mCharController(SID_SPOTLIGHT_CHARSTYLES, 
SfxViewFrame::Current()->GetBindings(), *this)
-    , mDFController(nSlotDFStyles, SfxViewFrame::Current()->GetBindings(), 
*this)
+    , 
nSlotDFStyles(pBindings->GetDispatcher()->GetSlot(".uno:HighlightCharDF")->GetSlotId())
+    , mParaController(SID_SPOTLIGHT_PARASTYLES, *pBindings, *this)
+    , mCharController(SID_SPOTLIGHT_CHARSTYLES, *pBindings, *this)
+    , mDFController(nSlotDFStyles, *pBindings, *this)
 {
     mpListBoxStyles->set_size_request(MinimumPanelWidth, -1);
     float fWidth = mpListBoxStyles->get_approximate_digit_width();
@@ -71,10 +71,9 @@ InspectorTextPanel::InspectorTextPanel(weld::Widget* pParent)
     mpToolbar->set_item_icon_name("directformatting", "sw/res/sr20012.png");
 
     // Setup listening and set initial state
-    SfxBindings& pBindings = SfxViewFrame::Current()->GetBindings();
-    pBindings.Update(SID_SPOTLIGHT_PARASTYLES);
-    pBindings.Update(SID_SPOTLIGHT_CHARSTYLES);
-    pBindings.Update(nSlotDFStyles);
+    pBindings->Update(SID_SPOTLIGHT_PARASTYLES);
+    pBindings->Update(SID_SPOTLIGHT_CHARSTYLES);
+    pBindings->Update(nSlotDFStyles);
 }
 
 static bool GetPropertyValues(std::u16string_view rPropName, const uno::Any& 
rAny,
diff --git a/sw/source/uibase/sidebar/SwPanelFactory.cxx 
b/sw/source/uibase/sidebar/SwPanelFactory.cxx
index 31f2a3f60ee2..181858f99f45 100644
--- a/sw/source/uibase/sidebar/SwPanelFactory.cxx
+++ b/sw/source/uibase/sidebar/SwPanelFactory.cxx
@@ -175,7 +175,7 @@ Reference<ui::XUIElement> SAL_CALL 
SwPanelFactory::createUIElement (
     }
     else if (rsResourceURL.endsWith("/WriterInspectorTextPanel"))
     {
-        std::unique_ptr<PanelLayout> xPanel = 
sw::sidebar::WriterInspectorTextPanel::Create(pParent);
+        std::unique_ptr<PanelLayout> xPanel = 
sw::sidebar::WriterInspectorTextPanel::Create(pParent, pBindings);
         xElement = sfx2::sidebar::SidebarPanelBase::Create(
             rsResourceURL,
             xFrame,
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
index bc457dbec441..91279617b120 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx
@@ -53,12 +53,13 @@ namespace sw::sidebar
 static void UpdateTree(SwDocShell& rDocSh, const SwEditShell& rEditSh,
                        std::vector<svx::sidebar::TreeNode>& aStore, sal_Int32& 
rParIdx);
 
-std::unique_ptr<PanelLayout> WriterInspectorTextPanel::Create(weld::Widget* 
pParent)
+std::unique_ptr<PanelLayout> WriterInspectorTextPanel::Create(weld::Widget* 
pParent,
+                                                              SfxBindings* 
pBindings)
 {
     if (pParent == nullptr)
         throw lang::IllegalArgumentException(
             u"no parent Window given to 
WriterInspectorTextPanel::Create"_ustr, nullptr, 0);
-    return std::make_unique<WriterInspectorTextPanel>(pParent);
+    return std::make_unique<WriterInspectorTextPanel>(pParent, pBindings);
 }
 
 namespace
@@ -69,8 +70,8 @@ SwWrtShell* GetWrtShell()
     return pDocSh ? pDocSh->GetWrtShell() : nullptr;
 }
 }
-WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent)
-    : InspectorTextPanel(pParent)
+WriterInspectorTextPanel::WriterInspectorTextPanel(weld::Widget* pParent, 
SfxBindings* pBindings)
+    : InspectorTextPanel(pParent, pBindings)
     , m_pShell(GetWrtShell())
     , m_nParIdx(0)
 {
diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx 
b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
index b952838e636a..c4c3fb04a53b 100644
--- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
+++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.hxx
@@ -29,9 +29,9 @@ namespace sw::sidebar
 class WriterInspectorTextPanel final : public svx::sidebar::InspectorTextPanel
 {
 public:
-    static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent);
+    static std::unique_ptr<PanelLayout> Create(weld::Widget* pParent, 
SfxBindings* pBindings);
 
-    WriterInspectorTextPanel(weld::Widget* pParent);
+    WriterInspectorTextPanel(weld::Widget* pParent, SfxBindings* pBindings);
 
     virtual ~WriterInspectorTextPanel() override;
 

Reply via email to