Skip to content

Commit

Permalink
vcsim: Handle prepare guest operations when svm is nil
Browse files Browse the repository at this point in the history
The existing code would panic due to not checking for svm being nil and
then immediately accessing a field to check power state.
  • Loading branch information
mayankbh committed Oct 16, 2023
1 parent c4befe0 commit db0ba92
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion simulator/container_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (svm *simVM) syncNetworkConfigToVMGuestProperties() error {
}

func (svm *simVM) prepareGuestOperation(auth types.BaseGuestAuthentication) types.BaseMethodFault {
if svm != nil && (svm.c == nil || svm.c.id == "") {
if svm == nil || svm.c == nil || svm.c.id == "" {
return new(types.GuestOperationsUnavailable)
}

Expand Down

0 comments on commit db0ba92

Please sign in to comment.