diff --git a/libnymea-app/things.h b/libnymea-app/things.h index 39c09ac6..44c64b6e 100644 --- a/libnymea-app/things.h +++ b/libnymea-app/things.h @@ -31,11 +31,14 @@ #ifndef THINGS_H #define THINGS_H -#include - #include "types/thing.h" #include "types/thingclass.h" +#include +#include + +Q_DECLARE_LOGGING_CATEGORY(dcThingManager) + class Things : public QAbstractListModel { Q_OBJECT diff --git a/libnymea-app/thingsproxy.cpp b/libnymea-app/thingsproxy.cpp index cdcf9165..8428627b 100644 --- a/libnymea-app/thingsproxy.cpp +++ b/libnymea-app/thingsproxy.cpp @@ -583,6 +583,10 @@ bool ThingsProxy::lessThan(const QModelIndex &left, const QModelIndex &right) co bool ThingsProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { Thing *thing = getInternal(source_row); + if (!thing) { + qCWarning(dcThingManager()) << "filterAcceptsRow called for a source row we can't find in the source model!"; + return false; + } if (!m_filterTagId.isEmpty()) { Tag *tag = m_engine->tagsManager()->tags()->findThingTag(thing->id().toString(), m_filterTagId); if (!tag) {