diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 17:48:38 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-21 21:08:53 +0200 |
commit | 34208a37bf22823ac80aa9fb7938af759c66f5ca (patch) | |
tree | 2588fa870a90b70d31caacf322b3119086937dae /sdext | |
parent | 062401fee55847fd646f73d95d9056950c1f1b1f (diff) |
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 <mike.kaganski@collabora.com>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/presenter/PresenterPaneBorderPainter.cxx | 13 |
1 files 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<rendering::XCanvasFont> const & GetFont ( + Reference<rendering::XCanvasFont> GetFont ( const Reference<rendering::XCanvas>& rxCanvas) const; SharedBitmapDescriptor mpTopLeft; @@ -304,7 +304,7 @@ bool PresenterPaneBorderPainter::ProvideTheme (const Reference<rendering::XCanva bModified = true; } - if (mpTheme != nullptr && bModified) + if (bModified) { if (mpRenderer == nullptr) mpRenderer.reset(new Renderer(mxContext, mpTheme)); @@ -872,12 +872,15 @@ awt::Rectangle RendererPaneStyle::RemoveBorder ( rBox.Height - pBorderSize->mnTop - pBorderSize->mnBottom); } -Reference<rendering::XCanvasFont> const & RendererPaneStyle::GetFont ( +Reference<rendering::XCanvasFont> RendererPaneStyle::GetFont ( const Reference<rendering::XCanvas>& rxCanvas) const { - if (mpFont.get() != nullptr) + if (mpFont) + { mpFont->PrepareFont(rxCanvas); - return mpFont->mxFont; + return mpFont->mxFont; + } + return Reference<rendering::XCanvasFont>(); } void RendererPaneStyle::UpdateBorderSizes() |