Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.
This repository was archived by the owner on Sep 7, 2021. It is now read-only.

panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx) #1396

@silver-chard

Description

@silver-chard

return convertAssign(dst, pk[0])

in session_find.go:259 ~ 271

containerValueSetFunc = func(newValue *reflect.Value, pk core.PK) error {
	keyValue := reflect.New(keyType)
	err := convertPKToValue(table, keyValue.Interface(), pk)
	if err != nil {
		return err
	}
	if isPointer {
		containerValue.SetMapIndex(keyValue.Elem(), newValue.Elem().Addr())
	} else {
		containerValue.SetMapIndex(keyValue.Elem(), newValue.Elem())
	}
	return nil
}	

session_find.go:306 containerValueSetFunc(&newValue, nil) . pk will be nil.
but in convertPKToValue. return convertAssign(dst, pk[0])
so ... nil[0] ....

Activity

changed the title [-]panic: index out of range when try to find(&map[xxx]xxx)[/-] [+]panic: index out of range when try to find(&map[int64]*xxx)[/+] on Aug 19, 2019
changed the title [-]panic: index out of range when try to find(&map[int64]*xxx)[/-] [+]panic: index out of range when try to .cols("xxx", "xxx", "xxx")find(&map[int64]*xxx)[/+] on Aug 19, 2019
changed the title [-]panic: index out of range when try to .cols("xxx", "xxx", "xxx")find(&map[int64]*xxx)[/-] [+]panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx)[/+] on Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @lunny@silver-chard

      Issue actions

        panic: index out of range when try to .cols("xxx", "xxx", "xxx").find(&map[int64]*xxx) · Issue #1396 · go-xorm/xorm