cid#1504593 silence Dereference null return value

and

cid#1504597 Dereference null return value
cid#1504595 Dereference null return value
cid#1504666 Dereference null return value

Change-Id: I6054120575fb2769633177c36eb41c6798c4c648
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135436
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-06-05 14:44:35 +01:00
parent 264b78cbd7
commit 86d39afd85
3 changed files with 12 additions and 8 deletions

View file

@ -91,8 +91,9 @@ void ODbAdminDialog::impl_selectDataSource(const css::uno::Any& _aDataSourceName
Reference< XPropertySet > xDatasource = m_pImpl->getCurrentDataSource();
impl_resetPages( xDatasource );
const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*getOutputSet()->GetItem(DSID_TYPECOLLECTION));
::dbaccess::ODsnTypeCollection* pCollection = rCollectionItem.getCollection();
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
::dbaccess::DATASOURCE_TYPE eType = pCollection->determineType(getDatasourceType(*getOutputSet()));
// and insert the new ones
@ -177,8 +178,9 @@ void ODbAdminDialog::impl_resetPages(const Reference< XPropertySet >& _rxDatasou
// special case: MySQL Native does not have the generic "advanced" page
const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*getOutputSet()->GetItem(DSID_TYPECOLLECTION));
::dbaccess::ODsnTypeCollection* pCollection = rCollectionItem.getCollection();
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(getOutputSet()->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
::dbaccess::ODsnTypeCollection* pCollection = pCollectionItem->getCollection();
if ( pCollection->determineType(getDatasourceType( *m_xExampleSet )) == ::dbaccess::DST_MYSQL_NATIVE )
{
OString sMySqlNative("mysqlnative");

View file

@ -77,8 +77,9 @@ ODbTypeWizDialog::ODbTypeWizDialog(weld::Window* _pParent, SfxItemSet const * _p
m_xFinish->set_help_id(HID_DBWIZ_FINISH);
// no local resources needed anymore
const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*_pItems->GetItem(DSID_TYPECOLLECTION));
m_pCollection = rCollectionItem.getCollection();
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(_pItems->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
m_pCollection = pCollectionItem->getCollection();
ActivatePage();
setTitleBase(DBA_RES(STR_DATABASE_TYPE_CHANGE));

View file

@ -117,8 +117,9 @@ ODbTypeWizDialogSetup::ODbTypeWizDialogSetup(weld::Window* _pParent
{
// no local resources needed anymore
// extract the datasource type collection from the item set
const DbuTypeCollectionItem& rCollectionItem = dynamic_cast<const DbuTypeCollectionItem&>(*_pItems->GetItem(DSID_TYPECOLLECTION));
m_pCollection = rCollectionItem.getCollection();
const DbuTypeCollectionItem* pCollectionItem = dynamic_cast<const DbuTypeCollectionItem*>(_pItems->GetItem(DSID_TYPECOLLECTION));
assert(pCollectionItem && "must exist");
m_pCollection = pCollectionItem->getCollection();
assert(m_pCollection && "ODbTypeWizDialogSetup::ODbTypeWizDialogSetup : really need a DSN type collection !");