From ea2b13e9854aec115fe235b011f55708b948b24f Mon Sep 17 00:00:00 2001 From: Mikhail Voytenko Date: Wed, 1 Sep 2010 14:32:36 +0200 Subject: mib19: #163432# on document close the control might be already removed during the call --- vbahelper/source/msforms/vbauserform.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'vbahelper') diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index e10c3a373f94..16bc97babd7d 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -201,11 +201,14 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - aResult = uno::makeAny( xVBAControl ); + if ( xControl.is() ) + { + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + aResult = uno::makeAny( xVBAControl ); + } } return aResult; -- cgit