diff --git a/src/chat_gui4.cpp b/src/chat_gui4.cpp index 0bc1b2b..fcc1289 100644 --- a/src/chat_gui4.cpp +++ b/src/chat_gui4.cpp @@ -197,9 +197,9 @@ void ChatGui4::render(void) { msg_reg.remove(to_remove.cbegin(), to_remove.cend()); } - msg_reg.view() - .use() - .each([&](const Message3 e, Message::Components::ContactFrom& c_from, Message::Components::ContactTo& c_to, Message::Components::Timestamp ts + auto tmp_view = msg_reg.view(); + tmp_view.use(); + tmp_view.each([&](const Message3 e, Message::Components::ContactFrom& c_from, Message::Components::ContactTo& c_to, Message::Components::Timestamp ts ) { // TODO: why? ImGui::TableNextRow(0, TEXT_BASE_HEIGHT); @@ -651,8 +651,10 @@ bool ChatGui4::renderContactListContactBig(const Contact3 c, const bool selected // TODO: is there a better way? // maybe cache mm? bool has_unread = false; - if (const auto* mm = _rmm.get(c); mm != nullptr && !mm->storage().empty()) { - has_unread = true; + if (const auto* mm = _rmm.get(c); mm != nullptr) { + if (const auto* unread_storage = mm->storage(); unread_storage != nullptr && !unread_storage->empty()) { + has_unread = true; + } } ImGui::Text("%s%s", has_unread?"* ":"", (_cr.all_of(c) ? _cr.get(c).name.c_str() : ""));