From 6f7bceb193cb043c3b4d8f69c44ff43679cca8a4 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Tue, 12 Nov 2024 14:51:03 -0800 Subject: [PATCH] fix: vcsim: avoid possible panic when applying PropertyFilter Signed-off-by: Doug MacEachern --- simulator/property_filter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/simulator/property_filter.go b/simulator/property_filter.go index ca6f42423..95f4a597e 100644 --- a/simulator/property_filter.go +++ b/simulator/property_filter.go @@ -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)