[empathy] Ignore the drop if we can't get the right information from it
- From: Sjoerd Simons <sjoerds src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] Ignore the drop if we can't get the right information from it
- Date: Mon, 14 Sep 2009 22:32:48 +0000 (UTC)
commit c5f8856f80196642a8df35af72160ce9b260efdd
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date: Mon Sep 14 23:12:38 2009 +0100
Ignore the drop if we can't get the right information from it
src/empathy-chat-window.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 7cad17c..9e89f75 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -1259,9 +1259,9 @@ chat_window_drag_data_received (GtkWidget *widget,
EmpathyChatWindow *window)
{
if (info == DND_DRAG_TYPE_CONTACT_ID) {
- EmpathyChat *chat;
+ EmpathyChat *chat = NULL;
EmpathyChatWindow *old_window;
- EmpathyAccount *account;
+ EmpathyAccount *account = NULL;
EmpathyAccountManager *account_manager;
const gchar *id;
gchar **strv;
@@ -1274,10 +1274,20 @@ chat_window_drag_data_received (GtkWidget *widget,
DEBUG ("DND contact from roster with id:'%s'", id);
strv = g_strsplit (id, ":", 2);
- account_id = strv[0];
- contact_id = strv[1];
- account = empathy_account_manager_get_account (account_manager, account_id);
- chat = empathy_chat_window_find_chat (account, contact_id);
+ if (g_strv_length (strv) == 2) {
+ account_id = strv[0];
+ contact_id = strv[1];
+ account =
+ empathy_account_manager_get_account (account_manager, account_id);
+ if (account != NULL)
+ chat = empathy_chat_window_find_chat (account, contact_id);
+ }
+
+ if (account == NULL) {
+ g_strfreev (strv);
+ gtk_drag_finish (context, FALSE, FALSE, time);
+ return;
+ }
if (!chat) {
TpConnection *connection;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]