Skip to content

Commit

Permalink
fix: assert Entity interface in mo.Value()
Browse files Browse the repository at this point in the history
Signed-off-by: Doug MacEachern <dougm@broadcom.com>
  • Loading branch information
dougm committed Dec 5, 2024
1 parent 46c15fb commit 973a224
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions vim25/mo/type_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,10 @@ func IsManagedObjectType(kind string) bool {
func Value(ref types.ManagedObjectReference) (Reference, bool) {
if rt, ok := t[ref.Type]; ok {
val := reflect.New(rt)
val.Interface().(Entity).Entity().Self = ref
return val.Elem().Interface().(Reference), true
if e, ok := val.Interface().(Entity); ok {
e.Entity().Self = ref
return val.Elem().Interface().(Reference), true
}
}
return nil, false
}
Expand Down

0 comments on commit 973a224

Please sign in to comment.