comphelper/source/container/interfacecontainer2.cxx |    3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 61308112435628177b7884ab833ece843d37cd28
Author:     Matt K <matt...@gmail.com>
AuthorDate: Sun Nov 26 19:01:20 2023 -0600
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Nov 28 06:16:54 2023 +0100

    tdf#156648 Prevent LO from adding an empty event listener
    
    The problem is that an empty interface listener can be
    added in Basic, which then crashes when trying to fire
    an event on that listener.  The fix is to check for
    the existence of the listener before adding to the list
    of listeners.
    
    Change-Id: I3205ec1e6cdad431f6297f2b7833295b9eb64b8e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159978
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/comphelper/source/container/interfacecontainer2.cxx 
b/comphelper/source/container/interfacecontainer2.cxx
index 9acff0a7f761..df1c9e0e69e9 100644
--- a/comphelper/source/container/interfacecontainer2.cxx
+++ b/comphelper/source/container/interfacecontainer2.cxx
@@ -172,6 +172,9 @@ void OInterfaceContainerHelper2::copyAndResetInUse()
 sal_Int32 OInterfaceContainerHelper2::addInterface( const 
Reference<XInterface> & rListener )
 {
     OSL_ASSERT( rListener.is() );
+    if ( !rListener.is() )
+        return 0;
+
     MutexGuard aGuard( rMutex );
     if( bInUse )
         copyAndResetInUse();

Reply via email to