Skip to content

Commit

Permalink
Handle field not found possibility
Browse files Browse the repository at this point in the history
Unrelated to main body of work, but might as well fix it here.
  • Loading branch information
AndrewSisley committed Sep 27, 2023
1 parent 651c1fa commit 0fed4bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions db/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,12 @@ func (c *collection) saveValueToMerkleCRDT(
if err != nil {
return nil, 0, err
}
field, _ := c.Description().GetFieldByID(client.FieldID(fieldID))

field, ok := c.Description().GetFieldByID(client.FieldID(fieldID))
if !ok {
return nil, 0, client.NewErrFieldIndexNotExist(fieldID)
}

merkleCRDT, err := c.db.crdtFactory.InstanceWithStores(
txn,
core.NewCollectionSchemaVersionKey(c.Schema().VersionID),
Expand All @@ -1337,7 +1342,6 @@ func (c *collection) saveValueToMerkleCRDT(
}

var bytes []byte
var ok bool
// parse args
if len(args) != 1 {
return nil, 0, ErrUnknownCRDTArgument
Expand Down

0 comments on commit 0fed4bf

Please sign in to comment.