diff --git a/src/Api/Controllers/SyncController.cs b/src/Api/Controllers/SyncController.cs index 1ce18a6df0..3a5dc2f8f5 100644 --- a/src/Api/Controllers/SyncController.cs +++ b/src/Api/Controllers/SyncController.cs @@ -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 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);