1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-02 23:41:21 +01:00

null check user

This commit is contained in:
Kyle Spearrin 2017-10-06 20:47:30 -04:00
parent 7e848e5c55
commit c7e7734dfc

View File

@ -7,6 +7,7 @@ using Bit.Core.Services;
using Bit.Core.Repositories;
using Bit.Core;
using Bit.Core.Enums;
using Bit.Core.Exceptions;
namespace Bit.Api.Controllers
{
@ -38,6 +39,11 @@ namespace Bit.Api.Controllers
public async Task<SyncResponseModel> Get()
{
var user = await _userService.GetUserByPrincipalAsync(User);
if(user == null)
{
throw new BadRequestException("User not found.");
}
var organizationUserDetails = await _organizationUserRepository.GetManyDetailsByUserAsync(user.Id,
OrganizationUserStatusType.Confirmed);
var folders = await _folderRepository.GetManyByUserIdAsync(user.Id);