dont allow sending empty messages (fixes #27)

also add a nullptr check just in case
This commit is contained in:
ouwou
2021-05-07 04:09:07 -04:00
parent 712e78b0c8
commit dd7852014f
2 changed files with 7 additions and 2 deletions

View File

@@ -143,8 +143,10 @@ void ChatMessageItemContainer::UpdateReactions() {
}
void ChatMessageItemContainer::SetFailed() {
m_text_component->get_style_context()->remove_class("pending");
m_text_component->get_style_context()->add_class("failed");
if (m_text_component != nullptr) {
m_text_component->get_style_context()->remove_class("pending");
m_text_component->get_style_context()->add_class("failed");
}
}
void ChatMessageItemContainer::UpdateAttributes() {

View File

@@ -200,6 +200,9 @@ bool ChatWindow::OnInputSubmit(const Glib::ustring &text) {
if (!m_rate_limit_indicator->CanSpeak())
return false;
if (text.size() == 0)
return false;
if (m_active_channel.IsValid())
m_signal_action_chat_submit.emit(text, m_active_channel, m_replying_to); // m_replying_to is checked for invalid in the handler
if (m_is_replying)