From cdacbafae444f3ff3e752ecf7d2a6cd8350e244c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Bispo?= Date: Mon, 24 Jul 2023 09:29:06 +0100 Subject: [PATCH] [PM-2297] Fix state var crash --- src/Core/Services/StateService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Core/Services/StateService.cs b/src/Core/Services/StateService.cs index a4992e829..480bacaaa 100644 --- a/src/Core/Services/StateService.cs +++ b/src/Core/Services/StateService.cs @@ -518,6 +518,10 @@ namespace Bit.Core.Services var reconciledOptions = ReconcileOptions(new StorageOptions { UserId = userId }, await GetDefaultStorageOptionsAsync()); var deviceKeyB64 = await _storageMediatorService.GetAsync(Constants.DeviceKeyKey(reconciledOptions.UserId), true); + if (string.IsNullOrEmpty(deviceKeyB64)) + { + return null; + } return new SymmetricCryptoKey(Convert.FromBase64String(deviceKeyB64)); }