use defer prepareing for panic/recover

This commit is contained in:
sawada_shinnosuke 2016-09-26 12:44:23 +09:00
parent 7b5ac89633
commit 1b423b7807
1 changed files with 1 additions and 1 deletions

View File

@ -848,6 +848,7 @@ func (engine *Engine) Having(conditions string) *Session {
func (engine *Engine) autoMapType(v reflect.Value) *core.Table { func (engine *Engine) autoMapType(v reflect.Value) *core.Table {
t := v.Type() t := v.Type()
engine.mutex.Lock() engine.mutex.Lock()
defer engine.mutex.Unlock()
table, ok := engine.Tables[t] table, ok := engine.Tables[t]
if !ok { if !ok {
table = engine.mapType(v) table = engine.mapType(v)
@ -860,7 +861,6 @@ func (engine *Engine) autoMapType(v reflect.Value) *core.Table {
} }
} }
} }
engine.mutex.Unlock()
return table return table
} }