aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5376535..5ef47a7 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3203,6 +3203,9 @@ namespace QuickMedia {
// TODO: Optimize with hash map?
auto find_body_item_by_event_id = [](std::shared_ptr<BodyItem> *body_items, size_t num_body_items, const std::string &event_id, size_t *index_result = nullptr) -> std::shared_ptr<BodyItem> {
+ if(event_id.empty())
+ return nullptr;
+
for(size_t i = 0; i < num_body_items; ++i) {
auto &body_item = body_items[i];
if(body_item->userdata && static_cast<Message*>(body_item->userdata)->event_id == event_id) {
@@ -3211,6 +3214,7 @@ namespace QuickMedia {
return body_item;
}
}
+
return nullptr;
};
@@ -3465,6 +3469,10 @@ namespace QuickMedia {
auto body_item = find_body_item_by_event_id(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size(), message->related_event_id);
if(body_item) {
Message *orig_message = static_cast<Message*>(body_item->userdata);
+ if(!orig_message) {
+ show_notification("QuickMedia", "Unexpected error, failed to set replaced by message", Urgency::CRITICAL);
+ return;
+ }
orig_message->replaced_by = message;
}
} else if(message->related_event_type == RelatedEventType::REPLY) {
@@ -4790,6 +4798,7 @@ namespace QuickMedia {
room_desc.erase(room_desc.begin() + last_line_start - 1, room_desc.end());
}
current_room->body_item->set_description(std::move(room_desc));
+ current_room->body_item->set_description_color(sf::Color(179, 179, 179));
// TODO: Show a line like nheko instead for unread messages, or something else
current_room->body_item->set_title_color(sf::Color::White);
current_room->last_message_read = true;