Commit 9d068292 authored by Tomaz  Canabrava's avatar Tomaz Canabrava

Do not crash on assert

I don't know if this is the right thing to do, but since it
actually crashed for me more than 10 times in a row (even when
I cleaned the preferences, the duchain, etc) it seem logical that
this *could* actually return an index from a different model,
so instead of asserting, return a invalid index.
parent 92772fe0
Pipeline #10460 passed with stage
in 47 minutes and 16 seconds
......@@ -265,7 +265,9 @@ QModelIndex ProjectTreeView::mapFromSource(const QAbstractProxyModel* proxy, con
else {
const auto* nextProxy = qobject_cast<const QAbstractProxyModel*>(next);
QModelIndex idx = mapFromSource(nextProxy, sourceIdx);
Q_ASSERT(idx.model() == nextProxy);
if (idx.model() != nextProxy) {
return {};
}
return proxy->mapFromSource(idx);
}
}
......
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