Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Commit

Permalink
fix: property fields in a property list cannot be removed (#160)
Browse files Browse the repository at this point in the history
* fix

* fix pr comments
  • Loading branch information
yk-eukarya authored Jul 19, 2022
1 parent 62dede2 commit 358237b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/property/pointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion pkg/property/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit 358237b

Please sign in to comment.