diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-12 12:21:31 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-12 12:21:59 +0000 |
commit | 20043e3fa26dfe7574bc5e985455c7042e0e53f9 (patch) | |
tree | 4c39522ebc8f100f717bd31eeaa611e6a125f524 | |
parent | c0081fe0f44610a9a78a764b02dff1879c263116 (diff) |
coverity#1394296 Dereference before null check
Change-Id: I143b7439b33695aa5bc4e32fd9386692eac37697
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ModelImpl.hxx | 2 |
2 files changed, 12 insertions, 15 deletions
diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx b/dbaccess/source/core/dataaccess/ModelImpl.cxx index e3d4a24ae2ad..f76875ac5445 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.cxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx @@ -400,7 +400,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( const Reference< XComponentContext >& _r ,m_aContainer(4) ,m_aMacroMode( *this ) ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) - ,m_pDBContext( &_rDBContext ) + ,m_rDBContext( _rDBContext ) ,m_refCount(0) ,m_aEmbeddedMacros() ,m_bModificationLock( false ) @@ -434,7 +434,7 @@ ODatabaseModelImpl::ODatabaseModelImpl( ,m_aContainer(4) ,m_aMacroMode( *this ) ,m_nImposedMacroExecMode( MacroExecMode::NEVER_EXECUTE ) - ,m_pDBContext( &_rDBContext ) + ,m_rDBContext( _rDBContext ) ,m_refCount(0) ,m_aEmbeddedMacros() ,m_bModificationLock( false ) @@ -504,7 +504,7 @@ void ODatabaseModelImpl::impl_construct_nothrow() { DBG_UNHANDLED_EXCEPTION(); } - m_pDBContext->appendAtTerminateListener(*this); + m_rDBContext.appendAtTerminateListener(*this); } namespace @@ -982,11 +982,11 @@ void SAL_CALL ODatabaseModelImpl::release() if ( osl_atomic_decrement(&m_refCount) == 0 ) { acquire(); // prevent multiple releases - m_pDBContext->removeFromTerminateListener(*this); + m_rDBContext.removeFromTerminateListener(*this); dispose(); - m_pDBContext->storeTransientProperties(*this); - if ( m_pDBContext && !m_sDocumentURL.isEmpty() ) - m_pDBContext->revokeDatabaseDocument( *this ); + m_rDBContext.storeTransientProperties(*this); + if (!m_sDocumentURL.isEmpty()) + m_rDBContext.revokeDatabaseDocument(*this); delete this; } } @@ -1249,13 +1249,10 @@ void ODatabaseModelImpl::impl_switchToLogicalURL( const OUString& i_rDocumentURL m_sDocFileLocation = m_sDocumentURL; // register at the database context, or change registration - if ( m_pDBContext ) - { - if ( !sOldURL.isEmpty() ) - m_pDBContext->databaseDocumentURLChange( sOldURL, m_sDocumentURL ); - else - m_pDBContext->registerDatabaseDocument( *this ); - } + if (!sOldURL.isEmpty()) + m_rDBContext.databaseDocumentURLChange( sOldURL, m_sDocumentURL ); + else + m_rDBContext.registerDatabaseDocument( *this ); } OUString ODatabaseModelImpl::getObjectContainerStorageName( const ObjectType _eType ) diff --git a/dbaccess/source/core/dataaccess/ModelImpl.hxx b/dbaccess/source/core/dataaccess/ModelImpl.hxx index 32527923f0e1..8ed40c89b4b4 100644 --- a/dbaccess/source/core/dataaccess/ModelImpl.hxx +++ b/dbaccess/source/core/dataaccess/ModelImpl.hxx @@ -183,7 +183,7 @@ private: SharedStorage m_xDocumentStorage; ::rtl::Reference< ::sfx2::DocumentStorageModifyListener > m_pStorageModifyListener; - ODatabaseContext* m_pDBContext; + ODatabaseContext& m_rDBContext; DocumentEventsData m_aDocumentEvents; ::comphelper::NamedValueCollection m_aMediaDescriptor; |