sfx2/source/view/ipclient.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 965e6308522a21e77a4b19cafd018973b4097224
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Nov 29 08:42:37 2021 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Nov 29 11:15:35 2021 +0100

    cid#1494452 sfx2: fix null ptr deref in SfxInPlaceClient_Impl::saveObject()
    
    Null-checking "this->m_pClient" suggests that it may be null, but it has
    already been dereferenced on all paths leading to the check. Add the
    missing check at a previous usage.
    
    (cherry picked from commit d9105d434ac6127f151843c7a7dbcd16257fcc0b)
    
    Change-Id: I8ebb4f41b9c83d59e65563c26729e899d45881b4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126014
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 08898ba1573f..ce9d2fdfb6c7 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -212,7 +212,7 @@ uno::Reference < frame::XFrame > const & 
SfxInPlaceClient_Impl::GetFrame() const
 
 void SAL_CALL SfxInPlaceClient_Impl::saveObject()
 {
-    if (!m_bStoreObject || m_pClient->IsProtected())
+    if (!m_bStoreObject || (m_pClient && m_pClient->IsProtected()))
         // client wants to discard the object (usually it means the container 
document is closed while an object is active
         // and the user didn't request saving the changes
         return;

Reply via email to