Commit aa12b3c8 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Fix crash when using Discover during updates

BUG: 370906
parent 41588f4b
......@@ -166,6 +166,7 @@ void TransactionModel::addTransaction(Transaction *trans)
connect(trans, &Transaction::statusChanged, this, [this](){ transactionChanged(StatusTextRole); });
connect(trans, &Transaction::cancellableChanged, this, [this](){ transactionChanged(CancellableRole); });
connect(trans, &Transaction::progressChanged, this, [this](){ transactionChanged(ProgressRole); Q_EMIT progressChanged(); });
connect(trans, &QObject::destroyed, this, [this, trans](){ removeTransaction(trans); });
emit transactionAdded(trans);
}
......
......@@ -76,7 +76,8 @@ void UpdateModel::setBackend(ResourcesUpdatesModel* updates)
void UpdateModel::resourceHasProgressed(AbstractResource* res, qreal progress)
{
UpdateItem* item = itemFromResource(res);
Q_ASSERT(item);
if (!item)
return;
item->setProgress(progress);
const QModelIndex idx = indexFromItem(item);
......@@ -87,7 +88,7 @@ void UpdateModel::activityChanged()
{
if(ResourcesModel::global()->isFetching()) {
setResources(QList<AbstractResource*>());
} else if(!m_updates->isProgressing()) {
} else if(m_updates && !m_updates->isProgressing()) {
m_updates->prepare();
setResources(m_updates->toUpdate());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment