From 5174cc5c242a728b435ea2be8a2f7f998e15429b Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Mon, 4 Apr 2016 22:49:18 +0800 Subject: [PATCH] Only get address from non pointer when call method, fix #912 --- scope.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scope.go b/scope.go index 425abc6d..844df85c 100644 --- a/scope.go +++ b/scope.go @@ -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() }