block: fix handling non-existing devices

Don't yield None as DeviceInfo object. The device-get: event handlers
are expecte to yield anything only when there is a device.
This commit is contained in:
Marek Marczykowski-Górecki 2017-09-12 04:16:33 +02:00
parent f6d10ec243
commit fd5aaa8866
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -162,7 +162,9 @@ class BlockDeviceExtension(qubes.ext.Extension):
if not vm.is_running():
return
if not vm.app.vmm.offline_mode:
yield self.device_get(vm, ident)
device_info = self.device_get(vm, ident)
if device_info:
yield device_info
@qubes.ext.handler('device-list-attached:block')
def on_device_list_attached(self, vm, event, **kwargs):