Skip to content

Commit

Permalink
check for nil desc.Metadata before attempting to unmarshall, avoiding…
Browse files Browse the repository at this point in the history
… a segfault for non-virter VMs (#33)
  • Loading branch information
mmguero authored and JoelColledge committed Nov 25, 2024
1 parent d834012 commit fa0e6c1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/virter/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ func (v *Virter) VMInfo(vmName string) (*VMInfo, error) {
}

meta := metaWrapper{}
if desc.Metadata == nil {
// not a virter VM
return &VMInfo{Name: vmName}, nil
}
err = xml.Unmarshal([]byte(desc.Metadata.XML), &meta)
if err != nil {
// not a virter VM
Expand Down

0 comments on commit fa0e6c1

Please sign in to comment.