]> git.0d.be Git - empathy.git/commitdiff
Ignore the drop if we can't get the right information from it
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 14 Sep 2009 22:12:38 +0000 (23:12 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Mon, 14 Sep 2009 22:12:38 +0000 (23:12 +0100)
src/empathy-chat-window.c

index 7cad17c98e2e04b9202c871314a3c8eeb646d457..9e89f75351c07b32eedd7f061aba8d1f6d6ee083 100644 (file)
@@ -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;