From b4a741291d609a422f0e870ac7cd0668e8dbd0be Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 25 Mar 2021 13:11:58 +0000 Subject: cid#1473991 Dereference null return value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I11d9d685a278d31f591927b67637e9224a99fb27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113096 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- bean/com/sun/star/comp/beans/OOoBean.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 ) {} -- cgit v1.2.3