From 6eedbf6e10363bca5d1c11c7b06212434137662b Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 23 Oct 2011 13:48:00 +0200
Subject: [PATCH] fixes some traceback when doing filetransfer. Fixes #1205

---
 src/chat_control.py               | 4 ++--
 src/common/protocol/bytestream.py | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/chat_control.py b/src/chat_control.py
index db77f0d2b..c41e78c22 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -3194,7 +3194,7 @@ class ChatControl(ChatControlBase):
         Show an InfoBar on top of control
         """
         markup = '<b>%s:</b> %s' % (_('File transfer'), file_props['name'])
-        if file_props['desc']:
+        if 'desc' in file_props and file_props['desc']:
             markup += ' (%s)' % file_props['desc']
         markup += '\n%s: %s' % (_('Size'), helpers.convert_bytes(
             file_props['size']))
@@ -3223,7 +3223,7 @@ class ChatControl(ChatControlBase):
     def _got_file_completed(self, file_props):
         markup = '<b>%s:</b> %s' % (_('File transfer completed'),
             file_props['name'])
-        if file_props['desc']:
+        if 'desc' in file_props and file_props['desc']:
             markup += ' (%s)' % file_props['desc']
         b1 = gtk.Button(_('_Open Containing Folder'))
         b1.connect('clicked', self._on_open_ft_folder, file_props)
diff --git a/src/common/protocol/bytestream.py b/src/common/protocol/bytestream.py
index 9e7504c31..2f522f466 100644
--- a/src/common/protocol/bytestream.py
+++ b/src/common/protocol/bytestream.py
@@ -620,6 +620,10 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
                             self.send_success_connect_reply, None)
                 raise xmpp.NodeProcessed
 
+        if file_props is None:
+            log.warn('Gajim got streamhosts for unknown transfer. Ignoring it.')
+            raise xmpp.NodeProcessed
+
         file_props['streamhosts'] = streamhosts
         if file_props['type'] == 'r':
             gajim.socks5queue.connect_to_hosts(self.name, sid,
-- 
GitLab