Skip to content

Commit

Permalink
Merge pull request #3591 from dilyar85/fix/simulator-configureDevice
Browse files Browse the repository at this point in the history
fix: add controller type check in simulator configureDevice
  • Loading branch information
dilyar85 authored Oct 10, 2024
2 parents 4bc1e3d + 71378bc commit 5abc304
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions simulator/virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1289,11 +1289,13 @@ func (vm *VirtualMachine) configureDevice(
// Update device controller's key reference
if key != d.Key {
if device := devices.FindByKey(d.ControllerKey); device != nil {
c := device.(types.BaseVirtualController).GetVirtualController()
for i := range c.Device {
if c.Device[i] == key {
c.Device[i] = d.Key
break
if c, ok := device.(types.BaseVirtualController); ok {
c := c.GetVirtualController()
for i := range c.Device {
if c.Device[i] == key {
c.Device[i] = d.Key
break
}
}
}
}
Expand Down

0 comments on commit 5abc304

Please sign in to comment.