summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-28 18:06:34 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2023-10-30 13:07:54 +0100
commit51d50517df324e9f7d5e0ac7aed1bb150a8feeaf (patch)
tree63b09135b5378163c317ac6bd677ca72ce117923 /starmath
parent3640b7e807dc7bf34e598e94c327b6d6a3fd8b04 (diff)
pPrinter may be nullptr
E.g., calling storeToURL, generating a PDF, on an embedded formula. Change-Id: If74af90f9c3dfd54a328782ddecd0adf52b51a5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158591 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 8dda6270f8b9af6fcfba2a3a935612ab5a81c247) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158542 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/unomodel.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index f2f8abfb50e2..8a1a17011f45 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -909,8 +909,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SmModel::getRenderer(
throw RuntimeException();
SmPrinterAccess aPrinterAccess( *pDocSh );
- Printer *pPrinter = aPrinterAccess.GetPrinter();
- Size aPrtPaperSize ( pPrinter->GetPaperSize() );
+ Size aPrtPaperSize;
+ if (Printer *pPrinter = aPrinterAccess.GetPrinter())
+ aPrtPaperSize = pPrinter->GetPaperSize();
// if paper size is 0 (usually if no 'real' printer is found),
// guess the paper size
@@ -980,11 +981,16 @@ void SAL_CALL SmModel::render(
return;
SmPrinterAccess aPrinterAccess( *pDocSh );
- Printer *pPrinter = aPrinterAccess.GetPrinter();
- Size aPrtPaperSize ( pPrinter->GetPaperSize() );
- Size aOutputSize ( pPrinter->GetOutputSize() );
- Point aPrtPageOffset( pPrinter->GetPageOffset() );
+ Size aPrtPaperSize;
+ Size aOutputSize;
+ Point aPrtPageOffset;
+ if (Printer *pPrinter = aPrinterAccess.GetPrinter())
+ {
+ aPrtPaperSize = pPrinter->GetPaperSize();
+ aOutputSize = pPrinter->GetOutputSize();
+ aPrtPageOffset = pPrinter->GetPageOffset();
+ }
// no real printer ??
if (aPrtPaperSize.IsEmpty())