Skip to content

Commit

Permalink
Applying write lock even before nil check
Browse files Browse the repository at this point in the history
  • Loading branch information
Rohan Shah committed Sep 12, 2016
1 parent 5a6b31c commit 9ab71be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion context.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ func (c *Context) Error(err error) *Error {
// Set is used to store a new key/value pair exclusivelly for this context.
// It also lazy initializes c.Keys if it was not used previously.
func (c *Context) Set(key string, value interface{}) {
c.KeysLocker.Lock()
if c.Keys == nil {
c.Keys = make(map[string]interface{})
}
c.KeysLocker.Lock()
c.Keys[key] = value
c.KeysLocker.Unlock()
}
Expand Down

0 comments on commit 9ab71be

Please sign in to comment.