summaryrefslogtreecommitdiff
path: root/sw/qa/extras/htmlimport
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-05-22 10:45:47 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2024-05-23 09:35:31 +0200
commit16a56dfccbd3abd01ec370ce611880ad5c2cb8b8 (patch)
treef1b30e5afa5e4c19d68266d3bebf1999e81e0173 /sw/qa/extras/htmlimport
parentdddba389b79647f69f447e576cf7e880be5661c6 (diff)
sw/qa: warning C6011: Dereferencing NULL pointer
Change-Id: I2e84af9463b82600079660a1b136bc9a85d8eb0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167925 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/htmlimport')
-rw-r--r--sw/qa/extras/htmlimport/htmlimport.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/sw/qa/extras/htmlimport/htmlimport.cxx b/sw/qa/extras/htmlimport/htmlimport.cxx
index e7880c3427e9..74c93ae1d064 100644
--- a/sw/qa/extras/htmlimport/htmlimport.cxx
+++ b/sw/qa/extras/htmlimport/htmlimport.cxx
@@ -49,7 +49,9 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testPictureImport)
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
// The document contains two pictures stored as a link.
- sfx2::LinkManager& rLinkManager = pTextDoc->GetDocShell()->GetDoc()->GetEditShell()->GetLinkManager();
+ SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
+ CPPUNIT_ASSERT(pEditShell);
+ sfx2::LinkManager& rLinkManager = pEditShell->GetLinkManager();
CPPUNIT_ASSERT_EQUAL(size_t(2), rLinkManager.GetLinks().size());
rLinkManager.Remove(0,2);
CPPUNIT_ASSERT_EQUAL(size_t(0), rLinkManager.GetLinks().size());
@@ -106,8 +108,7 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testInlinedImagesPageAndParagraph)
// The document contains embedded pictures inlined for PageBackground and
// ParagraphBackground, check for their existence after import
- SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
- SwEditShell* pEditShell = pDoc->GetEditShell();
+ SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
CPPUNIT_ASSERT(pEditShell);
// images are not linked, check for zero links
@@ -210,8 +211,9 @@ CPPUNIT_TEST_FIXTURE(HtmlImportTest, testImageWidthAuto)
createSwWebDoc("image-width-auto.html");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
- SwTextAttr const*const pAttr(pTextDoc->GetDocShell()->GetDoc()->GetEditShell()->
- GetCursor()->GetPointNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT));
+ SwEditShell* const pEditShell(pTextDoc->GetDocShell()->GetDoc()->GetEditShell());
+ CPPUNIT_ASSERT(pEditShell);
+ SwTextAttr const*const pAttr(pEditShell->GetCursor()->GetPointNode().GetTextNode()->GetTextAttrForCharAt(0, RES_TXTATR_FLYCNT));
CPPUNIT_ASSERT(pAttr);
SwFrameFormat const*const pFmt(pAttr->GetFlyCnt().GetFrameFormat());
SwFormatFrameSize const& rSize(pFmt->GetFormatAttr(RES_FRM_SIZE));