From 6ed508ec6a4ecb3531899a69cbc746ccf65a4166 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 28 Feb 2018 07:43:56 +0800 Subject: [PATCH] Fix panic with raw SQL --- scope.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scope.go b/scope.go index 25077efc..150ac710 100644 --- a/scope.go +++ b/scope.go @@ -650,7 +650,7 @@ func (scope *Scope) buildCondition(clause map[string]interface{}, include bool) buff := bytes.NewBuffer([]byte{}) i := 0 for _, s := range str { - if s == '?' { + if s == '?' && len(replacements) > i { buff.WriteString(replacements[i]) i++ } else {