From 34208a37bf22823ac80aa9fb7938af759c66f5ca Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 21 Oct 2018 17:48:38 +0200 Subject: tdf#120703 (PVS): redundant nullptr check; unsafe pointer dereference V668 There is no sense in testing the 'mpTheme' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. V1004 The 'mpFont' pointer was used unsafely after it was verified against nullptr. Check lines: 879, 881. Change-Id: I47627de2cd98d3bb36e1ced7346ebe9177c21e65 Reviewed-on: https://gerrit.libreoffice.org/62141 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sdext/source/presenter/PresenterPaneBorderPainter.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index 551546995b90..9af437f15bce 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -69,7 +69,7 @@ namespace { awt::Rectangle RemoveBorder ( const awt::Rectangle& rBox, drawing::framework::BorderType eBorderType) const; - Reference const & GetFont ( + Reference GetFont ( const Reference& rxCanvas) const; SharedBitmapDescriptor mpTopLeft; @@ -304,7 +304,7 @@ bool PresenterPaneBorderPainter::ProvideTheme (const ReferencemnTop - pBorderSize->mnBottom); } -Reference const & RendererPaneStyle::GetFont ( +Reference RendererPaneStyle::GetFont ( const Reference& rxCanvas) const { - if (mpFont.get() != nullptr) + if (mpFont) + { mpFont->PrepareFont(rxCanvas); - return mpFont->mxFont; + return mpFont->mxFont; + } + return Reference(); } void RendererPaneStyle::UpdateBorderSizes() -- cgit v1.2.3