summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-28 18:06:34 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-28 21:40:43 +0200
commit8dda6270f8b9af6fcfba2a3a935612ab5a81c247 (patch)
tree840c15c7d6d8ccb6cdf823512846ff27bfc87f64
parent50abd90d739410ed34de5e7cd9c4308dc75f9ab6 (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>
-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 96e41599ddad..114fb29e43d7 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -958,8 +958,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
@@ -1029,11 +1030,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())