diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-09 22:32:21 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-13 07:40:25 -0600 |
commit | d211507e6607c046628ac5eebc79c533d0db0d00 (patch) | |
tree | 9fe16a743a12c18a0f1563c4baf475658f307445 | |
parent | c262f37c6a0ba64d39414b45fd54d172c50762c8 (diff) |
btrfsitem: Fix Extent.Clone() and Metadata.Clone()
-rw-r--r-- | lib/btrfs/btrfsitem/item_extent.go | 4 | ||||
-rw-r--r-- | lib/btrfs/btrfsitem/item_metadata.go | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/btrfs/btrfsitem/item_extent.go b/lib/btrfs/btrfsitem/item_extent.go index edfef7c..cf9b739 100644 --- a/lib/btrfs/btrfsitem/item_extent.go +++ b/lib/btrfs/btrfsitem/item_extent.go @@ -54,7 +54,9 @@ func (o Extent) Clone() Extent { ret.Refs = extentInlineRefPool.Get(len(o.Refs)) copy(ret.Refs, o.Refs) for i := range ret.Refs { - ret.Refs[i].Body = o.Refs[i].Body.CloneItem() + if o.Refs[i].Body != nil { + ret.Refs[i].Body = o.Refs[i].Body.CloneItem() + } } return ret } diff --git a/lib/btrfs/btrfsitem/item_metadata.go b/lib/btrfs/btrfsitem/item_metadata.go index 10ae994..90f7622 100644 --- a/lib/btrfs/btrfsitem/item_metadata.go +++ b/lib/btrfs/btrfsitem/item_metadata.go @@ -46,7 +46,9 @@ func (o Metadata) Clone() Metadata { ret.Refs = extentInlineRefPool.Get(len(o.Refs)) copy(ret.Refs, o.Refs) for i := range ret.Refs { - ret.Refs[i].Body = o.Refs[i].Body.CloneItem() + if o.Refs[i].Body != nil { + ret.Refs[i].Body = o.Refs[i].Body.CloneItem() + } } return ret } |