TizenRefApp-7788 Empty conversation displayed in thread list after deletion 42/146942/2 submit/tizen/20170831.131829
authorEvgen Servetnik <e.servetnik@samsung.com>
Thu, 31 Aug 2017 08:20:32 +0000 (11:20 +0300)
committerEvgen Servetnik <e.servetnik@samsung.com>
Thu, 31 Aug 2017 08:55:58 +0000 (11:55 +0300)
Change-Id: Ib8f2e7d295ff2e801b1f11aff813f528273463c6
Signed-off-by: Evgen Servetnik <e.servetnik@samsung.com>
src/MsgThread/Controller/src/ThreadList.cpp
src/MsgThread/Controller/src/ThreadListItem.cpp

index 82201a802ef28e5eff84b07a44dbe6d0a3b03d07..022efea69a0f96822a3ec957f80fcb11d661b1a2 100644 (file)
@@ -168,7 +168,7 @@ int ThreadList::cmpFunc(const ListItem &item1, const ListItem &item2)
 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);
@@ -249,8 +249,9 @@ void ThreadList::updateItems()
 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;
        }
 
@@ -324,7 +325,6 @@ void ThreadList::onMsgStorageThreadDelete(const ThreadId &threadId)
                ListView::deleteItem(*thread);
                updateSelectAllItem();
        }
-
        if (m_pListener)
                m_pListener->onThreadListChanged();
 }
index a3b1f6d59f99ad1271b10dbde23517a3fb7ee2ea..3abe2057a84e07e3a78b2d1e7c961f711dd54785 100644 (file)
@@ -81,8 +81,10 @@ void ThreadListItem::update(const MsgThreadItem &threadItem, bool updateUi)
                                m_UnreadCount = std::to_string(count);
                        }
                }
+       } else {
+               MSG_LOG_WARN("empty conv list");
+               return;
        }
-
        setState(state, false);
        updateMessage(threadItem);
        updateThumbnailAndName(threadItem, true);