[Libreoffice-commits] core.git: bean/com

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 25 14:47:25 UTC 2021


 bean/com/sun/star/comp/beans/OOoBean.java |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit b4a741291d609a422f0e870ac7cd0668e8dbd0be
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Mar 25 13:11:58 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Mar 25 15:46:43 2021 +0100

    cid#1473991 Dereference null return value
    
    Change-Id: I11d9d685a278d31f591927b67637e9224a99fb27
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113096
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/bean/com/sun/star/comp/beans/OOoBean.java b/bean/com/sun/star/comp/beans/OOoBean.java
index ca9442d58427..05b5288ea528 100644
--- a/bean/com/sun/star/comp/beans/OOoBean.java
+++ b/bean/com/sun/star/comp/beans/OOoBean.java
@@ -1405,10 +1405,9 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
             iConnection.addEventListener( this );
 
             // listen on a terminating OOo
-            try {
-                getOOoDesktop().addTerminateListener( this );
-            }
-            catch ( Throwable aExc ) {}
+            com.sun.star.frame.XDesktop xDesktop = getOOoDesktop();
+            if (xDesktop != null)
+                xDesktop.addTerminateListener( this );
 
             // start this thread as a daemon
             setDaemon( true );
@@ -1425,7 +1424,9 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
 
             // do not listen on a terminating OOo anymore
             try {
-                getOOoDesktop().removeTerminateListener( this );
+                com.sun.star.frame.XDesktop xDesktop = getOOoDesktop();
+                if (xDesktop != null)
+                    xDesktop.removeTerminateListener( this );
             }
             catch ( Throwable aExc ) {}
 


More information about the Libreoffice-commits mailing list