From c5f8856f80196642a8df35af72160ce9b260efdd Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Mon, 14 Sep 2009 23:12:38 +0100 Subject: Ignore the drop if we can't get the right information from it --- src/empathy-chat-window.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 7cad17c98..9e89f7535 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; -- cgit v1.2.3