void ThreadList::insertItem(ThreadId id)
{
MsgThreadItemRef threadItem = m_App.getMsgEngine().getStorage().getThread(id);
- if (threadItem) {
+ if (threadItem && threadItem->getId().isValid()) {
auto newItem = new ThreadListItem(*threadItem, m_App);
ListView::sortedInsertItem(*newItem);
navigateTo(*newItem);
void ThreadList::updateItem(ThreadListItem &item)
{
MsgThreadItemRef msgThread = m_App.getMsgEngine().getStorage().getThread(item.getThreadId());
- if (!msgThread) {
- MSG_LOG_ERROR("msgThread is null");
+ if (!msgThread || !msgThread->getId().isValid()) {
+ MSG_LOG_ERROR("msgThread is not valid");
+ item.destroy();
return;
}
ListView::deleteItem(*thread);
updateSelectAllItem();
}
-
if (m_pListener)
m_pListener->onThreadListChanged();
}
m_UnreadCount = std::to_string(count);
}
}
+ } else {
+ MSG_LOG_WARN("empty conv list");
+ return;
}
-
setState(state, false);
updateMessage(threadItem);
updateThumbnailAndName(threadItem, true);