Null check policies from SyncResponse before parsing (#767)

* Null check policies from SyncResponse before parsing

* Update src/Core/Services/SyncService.cs

formatting

Co-Authored-By: Kyle Spearrin <kspearrin@users.noreply.github.com>

Co-authored-by: Kyle Spearrin <kspearrin@users.noreply.github.com>
This commit is contained in:
Matt Portune 2020-03-12 15:45:34 -04:00 committed by GitHub
parent 120e179fb8
commit 94216cf745
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -365,7 +365,8 @@ namespace Bit.Core.Services
private async Task SyncPolicies(List<PolicyResponse> response) private async Task SyncPolicies(List<PolicyResponse> response)
{ {
var policies = response.ToDictionary(p => p.Id, p => new PolicyData(p)); var policies = response?.ToDictionary(p => p.Id, p => new PolicyData(p)) ??
new Dictionary<string, PolicyData>();
await _policyService.Replace(policies); await _policyService.Replace(policies);
} }
} }