From 92c610e78211f4d5127ffa37d9dc080a6c5b9ce5 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Wed, 26 Sep 2018 11:00:57 +0200 Subject: [PATCH] connection: avoid failing on NoneType in _hostinfo There is a potential race of a backend to be opened and being true on self._backend.is_open but self._hostinfo not being set yet. Avoid spurial bugs due to that by also checking against None before accessing subelements ot self._hostinfo Signed-off-by: Christian Ehrhardt --- virtManager/connection.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/virtManager/connection.py b/virtManager/connection.py index fce4d89f5..96bd04c25 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -318,12 +318,12 @@ class vmmConnection(vmmGObject): caps = property(lambda self: getattr(self, "_backend").caps) def host_memory_size(self): - if not self._backend.is_open(): + if not self._backend.is_open() or self._hostinfo is None: return 0 return self._hostinfo[1] * 1024 def host_active_processor_count(self): - if not self._backend.is_open(): + if not self._backend.is_open() or self._hostinfo is None: return 0 return self._hostinfo[2]