mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
null enhance
This commit is contained in:
parent
0656ddd50a
commit
ddb28a9b90
2 changed files with 8 additions and 3 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue