From 358237ba21b3f78a2b94e5b8d85c3cb3196582fc Mon Sep 17 00:00:00 2001 From: yk-eukarya <81808708+yk-eukarya@users.noreply.github.com> Date: Tue, 19 Jul 2022 12:19:23 +0300 Subject: [PATCH] fix: property fields in a property list cannot be removed (#160) * fix * fix pr comments --- pkg/property/pointer.go | 2 +- pkg/property/property.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/property/pointer.go b/pkg/property/pointer.go index 990eb73f..f844bcc1 100644 --- a/pkg/property/pointer.go +++ b/pkg/property/pointer.go @@ -216,7 +216,7 @@ func (p *Pointer) Test(sg SchemaGroupID, i ItemID, f FieldID) bool { } func (p *Pointer) TestItem(sg SchemaGroupID, i ItemID) bool { - return p.TestSchemaGroup(sg) && (p.item == nil || *p.item == i) + return p.TestSchemaGroup(sg) && (p.item == nil || p.item.Equal(i)) } func (p *Pointer) TestSchemaGroup(sg SchemaGroupID) bool { diff --git a/pkg/property/property.go b/pkg/property/property.go index c72f6c5a..add864f5 100644 --- a/pkg/property/property.go +++ b/pkg/property/property.go @@ -266,8 +266,11 @@ func (p *Property) RemoveField(ptr *Pointer) { return } - if group := ToGroup(p.Item(ptr)); group != nil { + item := p.Item(ptr) + if group := ToGroup(item); group != nil { group.RemoveField(fid) + } else if groupList := ToGroupList(item); groupList != nil { + groupList.RemoveFields(ptr) } }