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