fix: crash when adding resource packs directly in the folder
This fixes an issue in which, when adding a new resource pack externally to PolyMC, when the resource pack view was open, would crash poly. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
parent
42c81395b3
commit
9db27c6acc
@ -257,9 +257,12 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
// If the resource is resolving, but something about it changed, we don't want to
|
||||
// continue the resolving.
|
||||
if (current_resource->isResolving()) {
|
||||
auto task = (*m_active_parse_tasks.find(current_resource->resolutionTicket())).get();
|
||||
auto ticket = current_resource->resolutionTicket();
|
||||
if (m_active_parse_tasks.contains(ticket)) {
|
||||
auto task = (*m_active_parse_tasks.find(ticket)).get();
|
||||
task->abort();
|
||||
}
|
||||
}
|
||||
|
||||
m_resources[row].reset(new_resource);
|
||||
resolveResource(m_resources.at(row));
|
||||
@ -285,9 +288,12 @@ void ResourceFolderModel::applyUpdates(QSet<QString>& current_set, QSet<QString>
|
||||
Q_ASSERT(removed_set.contains(removed_it->get()->internal_id()));
|
||||
|
||||
if ((*removed_it)->isResolving()) {
|
||||
auto task = (*m_active_parse_tasks.find((*removed_it)->resolutionTicket())).get();
|
||||
auto ticket = (*removed_it)->resolutionTicket();
|
||||
if (m_active_parse_tasks.contains(ticket)) {
|
||||
auto task = (*m_active_parse_tasks.find(ticket)).get();
|
||||
task->abort();
|
||||
}
|
||||
}
|
||||
|
||||
beginRemoveRows(QModelIndex(), removed_index, removed_index);
|
||||
m_resources.erase(removed_it);
|
||||
|
Loading…
Reference in New Issue
Block a user