Skip to content

Commit 62697f3

Browse files
authored
Prevent panic from interface case
1 parent 948c16f commit 62697f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/uvm/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ func (uvm *UtilityVM) CloseCtx(ctx context.Context) (err error) {
323323
_ = uvm.WaitCtx(ctx)
324324
}
325325

326-
if uvm.HasConfidentialPolicy() && uvm.createOpts.(*OptionsLCOW).GuestStateFile != "" {
327-
vmgsFullPath := filepath.Join(uvm.createOpts.(*OptionsLCOW).BundleDirectory, uvm.createOpts.(*OptionsLCOW).GuestStateFile)
326+
if lopts, ok := uvm.createOpts.(*OptionsLCOW); ok && uvm.HasConfidentialPolicy() && lopts.GuestStateFile != "" {
327+
vmgsFullPath := filepath.Join(lopts.BundleDirectory, lopts.GuestStateFile)
328328
e := log.G(ctx).WithField("VMGS file", vmgsFullPath)
329329
e.Debug("removing VMGS file")
330330
if err := os.Remove(vmgsFullPath); err != nil {

0 commit comments

Comments
 (0)