svx/qa/unit/core.cxx | 4 ++++ svx/qa/unit/svdraw.cxx | 4 ++++ 2 files changed, 8 insertions(+)
New commits: commit a468c06f384b8ad2fb1260d375844accb18db2dc Author: Tarcísio Ladeia de Oliveira <wyrqu...@gmail.com> AuthorDate: Mon Nov 21 23:14:20 2022 -0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Nov 23 12:47:59 2022 +0100 svx/qa: add checks for PDFiumDocument pointer When compiled without PDFium, two tests in svx were causing segmentation faults, as they were trying to access null pointers. Add a check for the pointer returned and end test if it is a nullptr (based on how it is done in other tests). Change-Id: Iab3c341a20f002adc92fac22ef76ed022aa49422 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143081 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/svx/qa/unit/core.cxx b/svx/qa/unit/core.cxx index f834222ea009..a2976fd90eed 100644 --- a/svx/qa/unit/core.cxx +++ b/svx/qa/unit/core.cxx @@ -50,6 +50,10 @@ CPPUNIT_TEST_FIXTURE(Test, testChartExportToPdf) // Without the accompanying fix in place, this test would have failed, because the output was // empty (0 bytes). std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parsePDFExport(); + if (!pPdfDocument) + { + return; + } int nPageCount = pPdfDocument->getPageCount(); CPPUNIT_ASSERT_GREATER(0, nPageCount); } diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index c1c8bc435a9a..b20a08fe5092 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -498,6 +498,10 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testPageViewDrawLayerClip) // Then make sure that line shape gets clipped: std::unique_ptr<vcl::pdf::PDFiumDocument> pDoc = parsePDFExport(); + if (!pDoc) + { + return; + } std::unique_ptr<vcl::pdf::PDFiumPage> pPage1 = pDoc->openPage(0); CPPUNIT_ASSERT_EQUAL(3, pPage1->getObjectCount()); std::unique_ptr<vcl::pdf::PDFiumPage> pPage2 = pDoc->openPage(1);