diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index dd2c87e74..851f6fd16 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -281,12 +281,22 @@ void *RsGxsForumModel::getParentRef(void *ref,int& row) const { ForumModelIndex ref_entry; - if(mTreeMode == TREE_MODE_FLAT) - return NULL; - if(!convertRefPointerToTabEntry(ref,ref_entry) || ref_entry >= mPosts.size()) return NULL ; + if(mTreeMode == TREE_MODE_FLAT) + { + if(ref_entry == 0) + { + RsErr() << "getParentRef() shouldn't be asked for the parent of NULL" << std::endl; + row = 0; + } + else + row = ref_entry-1; + + return NULL; + } + ForumModelIndex parent_entry = mPosts[ref_entry].mParent; if(parent_entry == 0) // top level index @@ -726,7 +736,11 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vectorsecond.size();++i) if(it->second[i].second == mid) + { postId = it->first; + break; + } - for(uint32_t i=0;i