Only get address from non pointer when call method, fix #912

This commit is contained in:
Jinzhu 2016-04-04 22:49:18 +08:00
parent 9fd05d1bad
commit 5174cc5c24
1 changed files with 2 additions and 1 deletions

View File

@ -413,7 +413,8 @@ func (scope *Scope) CommitOrRollback() *Scope {
////////////////////////////////////////////////////////////////////////////////
func (scope *Scope) callMethod(methodName string, reflectValue reflect.Value) {
if reflectValue.CanAddr() {
// Only get address from non-pointer
if reflectValue.CanAddr() && reflectValue.Kind() != reflect.Ptr {
reflectValue = reflectValue.Addr()
}