Skip to content

Commit

Permalink
Merge pull request #1508 from vmware/fix-cm-panic
Browse files Browse the repository at this point in the history
Fix panic in compute manager
  • Loading branch information
annakhm authored Jan 17, 2025
2 parents 8450240 + 4be05d4 commit 8e87cdb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nsxt/policy_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,9 @@ func getElemOrEmptyMapFromSchema(d *schema.ResourceData, key string) map[string]
if e != nil {
elems := e.([]interface{})
if len(elems) > 0 {
return elems[0].(map[string]interface{})
if elemMap, ok := elems[0].(map[string]interface{}); ok {
return elemMap
}
}
}
return make(map[string]interface{})
Expand All @@ -647,7 +649,9 @@ func getElemOrEmptyMapFromMap(d map[string]interface{}, key string) map[string]i
if e != nil {
elems := e.([]interface{})
if len(elems) > 0 {
return elems[0].(map[string]interface{})
if elemMap, ok := elems[0].(map[string]interface{}); ok {
return elemMap
}
}
}
return make(map[string]interface{})
Expand Down

0 comments on commit 8e87cdb

Please sign in to comment.