better null checking decklist (#2510)
This commit is contained in:
parent
3b2eff2551
commit
212a7d00db
2 changed files with 3 additions and 2 deletions
|
@ -300,8 +300,9 @@ QModelIndex DeckListModel::addCard(const QString &cardName, const QString &zoneN
|
||||||
|
|
||||||
QModelIndex DeckListModel::nodeToIndex(AbstractDecklistNode *node) const
|
QModelIndex DeckListModel::nodeToIndex(AbstractDecklistNode *node) const
|
||||||
{
|
{
|
||||||
if (node == root)
|
if (node == nullptr || node == root)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
return createIndex(node->getParent()->indexOf(node), 0, node);
|
return createIndex(node->getParent()->indexOf(node), 0, node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ Qt::ItemFlags RemoteDeckList_TreeModel::flags(const QModelIndex &index) const
|
||||||
|
|
||||||
QModelIndex RemoteDeckList_TreeModel::nodeToIndex(Node *node) const
|
QModelIndex RemoteDeckList_TreeModel::nodeToIndex(Node *node) const
|
||||||
{
|
{
|
||||||
if (node == root)
|
if (node == nullptr || node == root)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
return createIndex(node->getParent()->indexOf(node), 0, node);
|
return createIndex(node->getParent()->indexOf(node), 0, node);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue