mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Fix: lrcompletermodel access to null ptr
This commit is contained in:
parent
56e145ecd8
commit
de850125aa
@ -22,15 +22,16 @@ QModelIndex CompleterModel::index(int row, int column, const QModelIndex &parent
|
||||
return createIndex(row, column, parentItem->child(row));
|
||||
}
|
||||
|
||||
QModelIndex CompleterModel::parent(const QModelIndex &child) const
|
||||
{
|
||||
if (child.isValid()){
|
||||
CompleterItem *childItem = static_cast<CompleterItem*>(child.internalPointer());
|
||||
QModelIndex CompleterModel::parent(const QModelIndex &child) const {
|
||||
if(child.isValid()) {
|
||||
if(CompleterItem *childItem = static_cast<CompleterItem *>(child.internalPointer());
|
||||
childItem) {
|
||||
CompleterItem *parentItem = childItem->parent();
|
||||
if (parentItem != &m_root) {
|
||||
if(parentItem != &m_root) {
|
||||
return indexFromItem(parentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
||||
void appendRow(CompleterItem* child);
|
||||
void appendRows(const QList<CompleterItem *> &children);
|
||||
private:
|
||||
CompleterItem* m_parent;
|
||||
CompleterItem* m_parent{nullptr};
|
||||
QVector<QSharedPointer<CompleterItem> > m_children;
|
||||
QString m_text;
|
||||
QIcon m_icon;
|
||||
|
Loading…
Reference in New Issue
Block a user