Skip to content

Commit

Permalink
fix: vcsim: avoid possible panic when applying PropertyFilter
Browse files Browse the repository at this point in the history
Signed-off-by: Doug MacEachern <dougm@broadcom.com>
  • Loading branch information
dougm committed Nov 15, 2024
1 parent d51c0a3 commit 6f7bceb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion simulator/property_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ func (f *PropertyFilter) matches(ctx *Context, ref types.ManagedObjectReference,
for _, p := range f.Spec.PropSet {
if p.Type != ref.Type {
if kind == nil {
kind = getManagedObject(ctx.Map.Get(ref)).Type()
obj := ctx.Map.Get(ref)
if obj == nil { // object may have since been deleted
continue
}
kind = getManagedObject(obj).Type()
}
// e.g. ManagedEntity, ComputeResource
field, ok := kind.FieldByName(p.Type)
Expand Down

0 comments on commit 6f7bceb

Please sign in to comment.