Fix crash when sending messages

ECM recently started adding -fhardened, which makes us crash here since we're doing things that aren't valid, but happened to work out fine previously.
This commit is contained in:
Tobias Fella
2024-12-10 21:05:01 +01:00
parent f6e3210b0d
commit 9cd4a7416e

View File

@@ -338,7 +338,8 @@ void ChatBarCache::postMessage()
relatesTo = Quotient::EventRelation::replyTo(replyId());
}
room->post<Quotient::RoomMessageEvent>(text(), *std::get<std::optional<Quotient::RoomMessageEvent::MsgType>>(result), std::move(content), relatesTo);
const auto type = std::get<std::optional<Quotient::RoomMessageEvent::MsgType>>(result);
room->post<Quotient::RoomMessageEvent>(text(), type ? *type : Quotient::RoomMessageEvent::MsgType::Text, std::move(content), relatesTo);
clearCache();
}