mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 17:35:19 +00:00
vm-device: bus: Remove unwrap() when upgrading weak reference
Rather return the None to the caller to handle instead. This removes the source of a potential panic. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
44b5a19209
commit
9fc2613b41
@ -112,7 +112,7 @@ impl Bus {
|
||||
.range(..=BusRange { base: addr, len: 1 })
|
||||
.rev()
|
||||
.next()?;
|
||||
Some((*range, dev.upgrade().unwrap().clone()))
|
||||
dev.upgrade().map(|d| (*range, d.clone()))
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user