Commit 47554237 authored by Ronan's avatar Ronan
Browse files

feat(MainDb): invalid chat message when event log is not valid

parent 397dbc39
......@@ -845,12 +845,20 @@ MainDb::MainDb (const shared_ptr<Core> &core) : AbstractDb(*new MainDbPrivate),
soci::session *session = dbSession.getBackendSession<soci::session>();
soci::rowset<soci::row> rows = (session->prepare << query, soci::use(chatRoomId));
for (const auto &row : rows) {
shared_ptr<EventLog> eventLog = getEventFromCache(resolveId(row, 0));
long long eventId = resolveId(row, 0);
shared_ptr<EventLog> eventLog = getEventFromCache(eventId);
if (eventLog) {
const EventLogPrivate *dEventLog = eventLog->getPrivate();
L_ASSERT(dEventLog->dbKey.isValid());
dEventLog->dbKey = MainDbEventKey();
}
// TODO: Try to add a better code here...
shared_ptr<ChatMessage> chatMessage = getChatMessageFromCache(eventId);
if (chatMessage) {
const ChatMessagePrivate *dChatMessage = chatMessage->getPrivate();
L_ASSERT(dChatMessage->dbKey.isValid());
dChatMessage->dbKey = MainDbChatMessageKey();
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment