From: Lukáš Doktor Date: Mon, 20 Jan 2020 07:12:02 +0000 (+0100) Subject: python: Treat None-return of greeting cmd X-Git-Tag: qemu-xen-4.14.0~153^2~38 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=52c68b8abb614a744fd1d2099bbb3768a6aad8ee;p=qemu-xen.git python: Treat None-return of greeting cmd In case qemu process dies the "monitor.cmd" returns None which gets passed to the "__negotiate_capabilities" and leads to unhandled exception. Let's only check the resp in case it has a value. Signed-off-by: Lukáš Doktor Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200120071202.30646-1-ldoktor@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py index 4b9a362240..f40586eedd 100644 --- a/python/qemu/qmp.py +++ b/python/qemu/qmp.py @@ -80,7 +80,7 @@ class QEMUMonitorProtocol: raise QMPConnectError # Greeting seems ok, negotiate capabilities resp = self.cmd('qmp_capabilities') - if "return" in resp: + if resp and "return" in resp: return greeting raise QMPCapabilitiesError