aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorLukáš Doktor <ldoktor@redhat.com>2020-01-20 08:12:02 +0100
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-07 15:12:48 +0100
commit52c68b8abb614a744fd1d2099bbb3768a6aad8ee (patch)
tree6dbf7c760a2228aa1652673b2f53b0b6c085b693 /python
parenta1e8bd2f5c2a7b42b243c9422f3a86e530665e9f (diff)
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 <ldoktor@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20200120071202.30646-1-ldoktor@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/qemu/qmp.py2
1 files changed, 1 insertions, 1 deletions
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