mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 12:12:59 +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));
|
||||
}
|
||||
|
||||
QModelIndex CompleterModel::parent(const QModelIndex &child) const
|
||||
{
|
||||
if (child.isValid()){
|
||||
CompleterItem *childItem = static_cast<CompleterItem*>(child.internalPointer());
|
||||
CompleterItem *parentItem = childItem->parent();
|
||||
if (parentItem != &m_root) {
|
||||
return indexFromItem(parentItem);
|
||||
}
|
||||
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) {
|
||||
return indexFromItem(parentItem);
|
||||
}
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int CompleterModel::rowCount(const QModelIndex &parent) const
|
||||
|
@ -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