Skip to content

Commit

Permalink
Merge pull request #3622 from dougm/apply-filter-panic
Browse files Browse the repository at this point in the history
fix: vcsim: avoid possible panic when applying PropertyFilter
  • Loading branch information
akutz authored Nov 13, 2024
2 parents 321b6f0 + 5e9a140 commit ddcfd6a
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 ddcfd6a

Please sign in to comment.