diff --git a/client/orm/orm_conds.go b/client/orm/orm_conds.go index f3fd66f0..b4e1ce7a 100644 --- a/client/orm/orm_conds.go +++ b/client/orm/orm_conds.go @@ -76,10 +76,13 @@ func (c Condition) AndNot(expr string, args ...interface{}) *Condition { // AndCond combine a condition to current condition func (c *Condition) AndCond(cond *Condition) *Condition { - c = c.clone() + if c == cond { panic(fmt.Errorf(" cannot use self as sub cond")) } + + c = c.clone() + if cond != nil { c.params = append(c.params, condValue{cond: cond, isCond: true}) }