         }
 
         guard let user = user else {
+            if !isUploadingAvatar { endEditing() }
             return
         }
 

            self?.stopLoading(shouldEndEditing: shouldEndEditing)
        }

        isUpdatingUser = true

        let updateUserRequest = UpdateUserRequest(user: user, currentPassword: currentPassword)

    }

    fileprivate func update(user: User?) {
        if let avatarFile = avatarFile {
            startLoading()
            isUploadingAvatar = true

            let client = API.current()?.client(UploadClient.self)
