mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:03:35 +02:00
Fix ScriptDiscoveryService.scriptsModel.parent() crash for invalid index
This commit is contained in:
parent
757a4f908b
commit
8c735ed6ae
1 changed files with 3 additions and 0 deletions
|
@ -85,6 +85,9 @@ QModelIndex ScriptsModel::index(int row, int column, const QModelIndex& parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex ScriptsModel::parent(const QModelIndex& child) const {
|
QModelIndex ScriptsModel::parent(const QModelIndex& child) const {
|
||||||
|
if (!child.isValid()) {
|
||||||
|
return QModelIndex();
|
||||||
|
}
|
||||||
TreeNodeFolder* parent = (static_cast<TreeNodeBase*>(child.internalPointer()))->getParent();
|
TreeNodeFolder* parent = (static_cast<TreeNodeBase*>(child.internalPointer()))->getParent();
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
Loading…
Reference in a new issue