fix out of range error

This commit is contained in:
KEHyeon 2025-04-13 19:05:14 +09:00
parent f5ac40e395
commit 8492af206f

View File

@ -122,7 +122,7 @@ func (p *processor) Execute(db *DB) *DB {
stmt.ReflectValue = stmt.ReflectValue.Elem()
}
if (stmt.ReflectValue.Kind() == reflect.Slice || stmt.ReflectValue.Kind() == reflect.Array) &&
(stmt.ReflectValue.Len() > 0 || stmt.ReflectValue.Index(0).Kind() == reflect.Interface) {
(stmt.ReflectValue.Len() > 0 && stmt.ReflectValue.Index(0).Kind() == reflect.Interface) {
len := stmt.ReflectValue.Len()
firstElem := stmt.ReflectValue.Index(0)
for firstElem.Kind() == reflect.Interface || firstElem.Kind() == reflect.Ptr {
@ -140,7 +140,6 @@ func (p *processor) Execute(db *DB) *DB {
structArrayReflectValue = reflect.Append(structArrayReflectValue, elem)
}
stmt.ReflectValue = structArrayReflectValue
fmt.Println(stmt.ReflectValue.Type())
}
if !stmt.ReflectValue.IsValid() {
db.AddError(ErrInvalidValue)