vcl/unx/generic/gdi/salvd.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit e3ffbd80413b27b11c43bfce6cd9753a95e5e8f3
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Apr 30 20:56:28 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sat May 1 15:32:15 2021 +0200

    cid#1478001 Dereference before null check
    
    Change-Id: I86fe97280c62bf871b23ea2e9274439bab7af929
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114947
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 0a824a44a889..ab9d2b65cb4a 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -93,6 +93,8 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const * 
pGraphics, tools::L
     m_nXScreen(0),
     bGraphics_(false)
 {
+    assert(pGraphics);
+
     SalColormap* pColormap = nullptr;
     bool bDeleteColormap = false;
 
@@ -127,8 +129,7 @@ X11SalVirtualDevice::X11SalVirtualDevice(SalGraphics const 
* pGraphics, tools::L
     {
         nDX_ = nDX;
         nDY_ = nDY;
-        m_nXScreen = pGraphics ? static_cast<X11SalGraphics const 
*>(pGraphics)->GetScreenNumber() :
-                                 
vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen();
+        m_nXScreen = static_cast<X11SalGraphics const 
*>(pGraphics)->GetScreenNumber();
         hDrawable_ = limitXCreatePixmap( GetXDisplay(),
                                          pDisplay_->GetDrawable( m_nXScreen ),
                                          nDX_, nDY_,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to