mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
null enhance
This commit is contained in:
@@ -64,7 +64,7 @@ namespace Wox.Infrastructure.Storage
|
||||
|
||||
try
|
||||
{
|
||||
var t = (T)binaryFormatter.Deserialize(stream);
|
||||
var t = ((T)binaryFormatter.Deserialize(stream)).NonNull();
|
||||
return t;
|
||||
}
|
||||
catch (System.Exception e)
|
||||
|
||||
@@ -49,20 +49,25 @@ namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
return _data;
|
||||
return _data.NonNull();
|
||||
}
|
||||
|
||||
private void Deserialize(string searlized)
|
||||
{
|
||||
try
|
||||
{
|
||||
_data = JsonConvert.DeserializeObject<T>(searlized, _serializerSettings).NonNull();
|
||||
_data = JsonConvert.DeserializeObject<T>(searlized, _serializerSettings);
|
||||
}
|
||||
catch (JsonSerializationException e)
|
||||
{
|
||||
LoadDefault();
|
||||
Log.Exception($"|JsonStrorage.Deserialize|Deserialize error for json <{FilePath}>", e);
|
||||
}
|
||||
|
||||
if (_data == null)
|
||||
{
|
||||
LoadDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadDefault()
|
||||
|
||||
Reference in New Issue
Block a user