Ignoring prefs cookie deserialization errors

This commit is contained in:
rockstardev 2020-07-27 16:40:54 -05:00
parent bce386bc7a
commit 97e5f2e656

View file

@ -43,7 +43,13 @@ namespace BTCPayServer.Controllers.Logic
var prefCookie = new UserPrefsCookie();
ctrl.Request.Cookies.TryGetValue(nameof(UserPrefsCookie), out var strPrefCookie);
if (!String.IsNullOrEmpty(strPrefCookie))
prefCookie = JsonConvert.DeserializeObject<UserPrefsCookie>(strPrefCookie);
{
try
{
prefCookie = JsonConvert.DeserializeObject<UserPrefsCookie>(strPrefCookie);
}
catch { /* ignore cookie deserialization failures */ }
}
return prefCookie;
}