aboutsummaryrefslogtreecommitdiff
path: root/examples/GuiClient/mainDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/GuiClient/mainDialog.cpp')
-rw-r--r--examples/GuiClient/mainDialog.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/examples/GuiClient/mainDialog.cpp b/examples/GuiClient/mainDialog.cpp
index 714a0331..07895a65 100644
--- a/examples/GuiClient/mainDialog.cpp
+++ b/examples/GuiClient/mainDialog.cpp
@@ -355,9 +355,14 @@ void mainDialog::showChatDialog(const QString& bareJid)
void mainDialog::messageReceived(const QXmppMessage& msg)
{
- QString from = msg.from();
- getChatDialog(QXmppUtils::jidToBareJid(from))->show();
- getChatDialog(QXmppUtils::jidToBareJid(from))->messageReceived(msg.body());
+ if (msg.body().isEmpty())
+ return;
+
+ chatDialog *dialog = getChatDialog(QXmppUtils::jidToBareJid(msg.from()));
+ if (dialog) {
+ dialog->show();
+ dialog->messageReceived(msg.body());
+ }
}
void mainDialog::statusTextChanged(const QString& status)