svx/qa/unit/customshapes.cxx           |    8 +++++++-
 svx/qa/unit/svdraw.cxx                 |    1 +
 svx/qa/unit/table.cxx                  |    1 +
 sw/qa/extras/htmlexport/htmlexport.cxx |    1 +
 sw/qa/extras/uiwriter/uiwriter6.cxx    |    1 +
 sw/qa/unit/swmodeltestbase.cxx         |    1 +
 6 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 601ae6910288c7f3abdbb11de644c17b3b2d0cb5
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed May 15 21:08:50 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu May 16 09:34:49 2024 +0200

    WaE: C6011 Dereferencing NULL pointer warnings
    
    Change-Id: If4ca47bc4d8203ed7d20e1bbf1c3ebe2587c403f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167709
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index 304ae64f23b2..47ab375e6037 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -122,6 +122,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf150302)
 
     // Mark Object
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -157,6 +158,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf147409_GeomItemHash)
 
     // Mark Object
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -174,6 +176,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf146866_GeomItemHash)
 
     // Mark Object
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     pSdrView->MarkObj(pSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -502,6 +505,7 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf141021ExtrusionNorth)
 
     // Mark Object
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     pSdrView->MarkObj(&rSdrCustomShape, pSdrView->GetSdrPageView());
 
@@ -509,7 +513,9 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, 
testTdf141021ExtrusionNorth)
     SfxRequest aReq(pViewShell->GetViewFrame(), SID_EXTRUSION_DIRECTION);
     SfxInt32Item aItem(SID_EXTRUSION_DIRECTION, 90);
     aReq.AppendItem(aItem);
-    svx::ExtrusionBar::execute(pSdrView, aReq, 
SfxViewFrame::Current()->GetBindings());
+    SfxViewFrame* pFrame = SfxViewFrame::Current();
+    CPPUNIT_ASSERT(pFrame);
+    svx::ExtrusionBar::execute(pSdrView, aReq, pFrame->GetBindings());
 
     // Verify height. Without the fix in place the height would 4001.
     tools::Rectangle aBoundRect(rSdrCustomShape.GetCurrentBoundRect());
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 0c01bf4dfce2..83293c52ee3f 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -237,6 +237,7 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testTextEditEmptyGrabBag)
 
     // When editing the shape text of the 2nd rectangle (insert a char at the 
start).
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     SdrObject* pObject = SdrObject::getSdrObjectFromXShape(xRect2);
     pSdrView->SdrBeginTextEdit(pObject);
diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index 6331a23cbe98..ce48f216026a 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -120,6 +120,7 @@ CPPUNIT_TEST_FIXTURE(Test, 
testSvxTableControllerSetAttrToSelectedShape)
     auto pSdrObject
         = 
dynamic_cast<sdr::table::SdrTableObj*>(pSdrPage->GetObj(pSdrPage->GetObjCount() 
- 1));
     SfxViewShell* pViewShell = SfxViewShell::Current();
+    CPPUNIT_ASSERT(pViewShell);
     SdrView* pSdrView = pViewShell->GetDrawView();
     pSdrView->SdrBeginTextEdit(pSdrObject);
     CPPUNIT_ASSERT(pSdrView->IsTextEdit());
diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx 
b/sw/qa/extras/htmlexport/htmlexport.cxx
index 282ce035b3a6..b3297ad815fe 100644
--- a/sw/qa/extras/htmlexport/htmlexport.cxx
+++ b/sw/qa/extras/htmlexport/htmlexport.cxx
@@ -2866,6 +2866,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, 
testHTML_NoPreserveSpaces)
               xmlXPathObjectPtr pXmlObj = getXPathNode(pDoc, rXPath);
               xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
               CPPUNIT_ASSERT_EQUAL_MESSAGE(rXPath.getStr(), 1, 
xmlXPathNodeSetGetLength(pXmlNodes));
+              CPPUNIT_ASSERT(pXmlNodes);
               xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
               if (xmlChar* prop = xmlGetProp(pXmlNode, BAD_CAST("style")))
               {
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx 
b/sw/qa/extras/uiwriter/uiwriter6.cxx
index ce525954ace9..43c74906e10d 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -2180,6 +2180,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535)
         // choose the word "Baaed" from the spelling suggestions of the 
context menu
 
         SfxViewShell* pViewShell = SfxViewShell::Current();
+        CPPUNIT_ASSERT(pViewShell);
         {
             static constexpr OUStringLiteral sApplyRule(u"Spelling_Baaed");
             SfxStringItem aApplyItem(FN_PARAM_1, sApplyRule);
diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx
index 9e149d43b6bc..28445c64d409 100644
--- a/sw/qa/unit/swmodeltestbase.cxx
+++ b/sw/qa/unit/swmodeltestbase.cxx
@@ -184,6 +184,7 @@ OUString SwModelTestBase::parseDump(const OString& aXPath, 
const OString& aAttri
         int nNodes = xmlXPathNodeSetGetLength(pXmlNodes);
         OString aMessage("xpath ('" + aXPath + "') should match exactly 1 
node");
         CPPUNIT_ASSERT_EQUAL_MESSAGE(aMessage.getStr(), 1, nNodes);
+        CPPUNIT_ASSERT(pXmlNodes);
         xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
         if (aAttribute.getLength())
             pXpathStrResult = xmlGetProp(pXmlNode, 
BAD_CAST(aAttribute.getStr()));

Reply via email to