From 0fed4bf3bc9e749010b540b85f8291b6fe4647c3 Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Wed, 27 Sep 2023 15:12:08 -0400 Subject: [PATCH] Handle field not found possibility Unrelated to main body of work, but might as well fix it here. --- db/collection.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db/collection.go b/db/collection.go index cda5cbf584..ebc8ed4d1a 100644 --- a/db/collection.go +++ b/db/collection.go @@ -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), @@ -1337,7 +1342,6 @@ func (c *collection) saveValueToMerkleCRDT( } var bytes []byte - var ok bool // parse args if len(args) != 1 { return nil, 0, ErrUnknownCRDTArgument