[Libreoffice-commits] core.git: sdext/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Oct 21 19:09:16 UTC 2018


 sdext/source/presenter/PresenterPaneBorderPainter.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 34208a37bf22823ac80aa9fb7938af759c66f5ca
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Oct 21 17:48:38 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Oct 21 21:08:53 2018 +0200

    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 at collabora.com>

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()


More information about the Libreoffice-commits mailing list