diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index c5c78e119..a20bcffdf 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -739,9 +739,9 @@ void ChatRoomModel::initEntries(){ mIsInitialized = true; if(entries.size() >0){ - beginInsertRows(QModelIndex(), 0, entries.size()-1); + beginResetModel(); mEntries = entries; - endInsertRows(); + endResetModel(); } } diff --git a/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp b/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp index 29d24b700..d989d9741 100644 --- a/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp @@ -181,7 +181,10 @@ bool ChatRoomProxyModel::lessThan (const QModelIndex &left, const QModelIndex &r b = r.value(); if(!b) b = r.value(); - + if(!b) + return true; + if(!a) + return false; return a->mTimestamp < b->mTimestamp; } // -----------------------------------------------------------------------------