From a29a00178efcd26de9cde4693b560eaadbd10055 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Fri, 19 Jun 2009 07:23:08 +0200
Subject: [PATCH] prevent traceback when we get malformed data in adhoc
 process.

---
 src/adhoc_commands.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/adhoc_commands.py b/src/adhoc_commands.py
index 85b946b141..9b96f0fee7 100644
--- a/src/adhoc_commands.py
+++ b/src/adhoc_commands.py
@@ -297,7 +297,9 @@ class CommandWindow:
 		self.send_command(action)
 
 	def stage3_next_form(self, command):
-		assert isinstance(command, xmpp.Node)
+		if not isinstance(command, xmpp.Node):
+			self.stage5(error=_('Service sent malformed data'), senderror=True)
+			return
 
 		self.remove_pulsing()
 		self.sending_form_progressbar.hide()
@@ -307,6 +309,7 @@ class CommandWindow:
 		elif self.sessionid != command.getAttr('sessionid'):
 			self.stage5(error=_('Service changed the session identifier.'),
 				senderror=True)
+			return
 
 		self.form_status = command.getAttr('status')
 
-- 
GitLab