Commit 88b201ef authored by Gus Grubba's avatar Gus Grubba

Don't crash on bad index

parent 17370aa4
......@@ -32,6 +32,14 @@ QmlObjectListModel::~QmlObjectListModel()
}
QObject* QmlObjectListModel::get(int index)
{
if (index < 0 || index >= _objectList.count()) {
return nullptr;
}
return _objectList[index];
}
int QmlObjectListModel::rowCount(const QModelIndex& parent) const
{
Q_UNUSED(parent);
......
......@@ -27,7 +27,7 @@ public:
/// a dirty property and dirtyChanged signal.
Q_PROPERTY(bool dirty READ dirty WRITE setDirty NOTIFY dirtyChanged)
Q_INVOKABLE QObject* get(int index) { return _objectList[index]; }
Q_INVOKABLE QObject* get(int index);
// Property accessors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment