mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-09 11:12:40 +02:00
Merge pull request #16110 from ctrlaltdavid/BUGZ-1357
BUGZ-1357: Fix crashes in ScriptDiscoveryService API
This commit is contained in:
commit
e4bcbf60ed
1 changed files with 4 additions and 1 deletions
|
@ -78,13 +78,16 @@ TreeNodeBase* ScriptsModel::getTreeNodeFromIndex(const QModelIndex& index) const
|
|||
}
|
||||
|
||||
QModelIndex ScriptsModel::index(int row, int column, const QModelIndex& parent) const {
|
||||
if (row < 0 || column < 0) {
|
||||
if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent)) {
|
||||
return QModelIndex();
|
||||
}
|
||||
return createIndex(row, column, getFolderNodes(static_cast<TreeNodeFolder*>(getTreeNodeFromIndex(parent))).at(row));
|
||||
}
|
||||
|
||||
QModelIndex ScriptsModel::parent(const QModelIndex& child) const {
|
||||
if (!child.isValid()) {
|
||||
return QModelIndex();
|
||||
}
|
||||
TreeNodeFolder* parent = (static_cast<TreeNodeBase*>(child.internalPointer()))->getParent();
|
||||
if (!parent) {
|
||||
return QModelIndex();
|
||||
|
|
Loading…
Reference in a new issue