From 8a4deb8c70cd6464013dd954a544e1c4639166d0 2017-07-05 09:39:08 From: Alexandre Leroux Date: 2017-07-05 09:39:08 Subject: [PATCH] Minor fix --- diff --git a/core/include/DataSource/DataSourceController.h b/core/include/DataSource/DataSourceController.h index d274f88..0fb897c 100644 --- a/core/include/DataSource/DataSourceController.h +++ b/core/include/DataSource/DataSourceController.h @@ -37,7 +37,7 @@ public: * Sets the structure of a data source. The controller takes ownership of the structure. * @param dataSourceUid the unique id with which the data source has been registered into the * controller. If it is invalid, the method has no effect. - * @param dataSourceItem the structure of the data source + * @param dataSourceItem the structure of the data source. It must be not null to be registered * @sa registerDataSource() */ void setDataSourceItem(const QUuid &dataSourceUid, diff --git a/core/src/DataSource/DataSourceController.cpp b/core/src/DataSource/DataSourceController.cpp index bb87e87..6107311 100644 --- a/core/src/DataSource/DataSourceController.cpp +++ b/core/src/DataSource/DataSourceController.cpp @@ -49,6 +49,12 @@ QUuid DataSourceController::registerDataSource(const QString &dataSourceName) no void DataSourceController::setDataSourceItem( const QUuid &dataSourceUid, std::unique_ptr dataSourceItem) noexcept { + if (!dataSourceItem) { + qCWarning(LOG_DataSourceController()) + << tr("Data source item can't be registered (null item)"); + return; + } + if (impl->m_DataSources.contains(dataSourceUid)) { // The data provider is implicitly converted to a shared_ptr impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem)));