mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
fix: Check if ArrayData is nil to prevent panic (#44332)
issue: #44331 Signed-off-by: Cai Zhang <cai.zhang@zilliz.com>
This commit is contained in:
parent
060fc61e80
commit
62d416bf4f
@ -1186,14 +1186,14 @@ func fillFieldPropertiesBySchema(columns []*schemapb.FieldData, schema *schemapb
|
||||
// Set the ElementType because it may not be set in the insert request.
|
||||
if fieldData.Type == schemapb.DataType_Array {
|
||||
fd, ok := fieldData.Field.(*schemapb.FieldData_Scalars)
|
||||
if !ok {
|
||||
if !ok || fd.Scalars.GetArrayData() == nil {
|
||||
return fmt.Errorf("field convert FieldData_Scalars fail in fieldData, fieldName: %s,"+
|
||||
" collectionName:%s", fieldData.FieldName, schema.Name)
|
||||
}
|
||||
fd.Scalars.GetArrayData().ElementType = fieldSchema.ElementType
|
||||
} else if fieldData.Type == schemapb.DataType_ArrayOfVector {
|
||||
fd, ok := fieldData.Field.(*schemapb.FieldData_Vectors)
|
||||
if !ok {
|
||||
if !ok || fd.Vectors.GetVectorArray() == nil {
|
||||
return fmt.Errorf("field convert FieldData_Vectors fail in fieldData, fieldName: %s,"+
|
||||
" collectionName:%s", fieldData.FieldName, schema.Name)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user