diff options
author | Tarcísio Ladeia de Oliveira <wyrquill@gmail.com> | 2022-11-21 23:14:20 -0300 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-23 12:47:59 +0100 |
commit | a468c06f384b8ad2fb1260d375844accb18db2dc (patch) | |
tree | 87b21338204fb38c3442f0d80a7fc66ddf65c537 /svx/qa | |
parent | 9b3729d63cbed7c343f6c68983a40d9fbf329958 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/core.cxx | 4 | ||||
-rw-r--r-- | svx/qa/unit/svdraw.cxx | 4 |
2 files changed, 8 insertions, 0 deletions
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); |