Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
repository: prevent nil pointer dereference in error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Souza committed Feb 13, 2015
1 parent 0b591b0 commit 47ecc5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion repository/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,13 @@ func GrantAccess(rNames, uNames []string, readOnly bool) error {
} else {
info, err = conn.Repository().UpdateAll(bson.M{"_id": bson.M{"$in": rNames}}, bson.M{"$addToSet": bson.M{"users": bson.M{"$each": uNames}}})
}
if err != nil {
return err
}
if info.Updated < 1 {
return mgo.ErrNotFound
}
return err
return nil
}

// RevokeAccess revokes write permission from users in all specified
Expand Down

0 comments on commit 47ecc5d

Please sign in to comment.