summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/MUCSearch/MUCSearchModel.cpp')
-rw-r--r--Swift/QtUI/MUCSearch/MUCSearchModel.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp
index eb7fe20..2526039 100644
--- a/Swift/QtUI/MUCSearch/MUCSearchModel.cpp
+++ b/Swift/QtUI/MUCSearch/MUCSearchModel.cpp
@@ -59,8 +59,13 @@ QModelIndex MUCSearchModel::parent(const QModelIndex& index) const {
return QModelIndex();
}
MUCSearchServiceItem* parent = dynamic_cast<MUCSearchRoomItem*>(item)->getParent();
- int row = services_.indexOf(parent);
- return parent ? createIndex(row, 1, parent) : QModelIndex();
+ if (parent) {
+ int row = services_.indexOf(parent);
+ return createIndex(row, 1, parent);
+ }
+ else {
+ return QModelIndex();
+ }
}
int MUCSearchModel::rowCount(const QModelIndex& parentIndex) const {