Skip to content
Snippets Groups Projects
Commit b3715490 authored by Pierre Lamot's avatar Pierre Lamot
Browse files

qt: allow getCount to initiate the cache in MLBaseModel

The count property might be accessed before browsing the model.
parent 778686a9
No related branches found
No related tags found
No related merge requests found
......@@ -237,7 +237,7 @@ void MLBaseModel::unsetSortCriteria()
int MLBaseModel::rowCount(const QModelIndex &parent) const
{
if (parent.isValid())
if (!m_mediaLib || parent.isValid())
return 0;
validateCache();
......@@ -302,7 +302,10 @@ QVariantList MLBaseModel::getIdsForIndexes(QVariantList indexes) const
unsigned MLBaseModel::getCount() const
{
if (!m_cache || m_cache->count() == COUNT_UNINITIALIZED)
if (!m_mediaLib)
return 0;
validateCache();
if (m_cache->count() == COUNT_UNINITIALIZED)
return 0;
return static_cast<unsigned>(m_cache->count());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment