prevent js error when the avatar input is empty

stable
Juanfran 2014-11-04 15:28:50 +01:00
parent 00793d3ecc
commit 3be8e8561e
1 changed files with 3 additions and 2 deletions

View File

@ -138,8 +138,9 @@ UserAvatarDirective = ($auth, $model, $rs, $confirm) ->
$el.find("#avatar-field").click()
$el.on "change", "#avatar-field", (event) ->
$el.find('.overlay').show()
$rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError)
if $scope.avatarAttachment
$el.find('.overlay').show()
$rs.userSettings.changeAvatar($scope.avatarAttachment).then(onSuccess, onError)
# Use gravatar photo
$el.on "click", "a.use-gravatar", (event) ->