Skip to content

Commit

Permalink
Add comment and different error handling for copyTree
Browse files Browse the repository at this point in the history
Signed-off-by: grantseltzer <[email protected]>
  • Loading branch information
grantseltzer committed Dec 20, 2024
1 parent eecb032 commit be4efa2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/dynamicinstrumentation/diconfig/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,10 @@ func copyTree(dst, src *[]*ditypes.Parameter) {
*dst = make([]*ditypes.Parameter, len(*src))
copy(*dst, *src)
for i := range *src {

// elements can be nil if there was a nil element originally in src
// that was copied to dst
if (*dst)[i] == nil || (*src)[i] == nil {
return
continue
}
copyTree(&((*dst)[i].ParameterPieces), &((*src)[i].ParameterPieces))
}
Expand Down

0 comments on commit be4efa2

Please sign in to comment.