mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 01:08:18 +08:00
Don't crash if UserSelectedRecord.json
can not be updated (#11789)
This commit is contained in:
parent
735accc1a8
commit
c953f10c21
@ -169,9 +169,24 @@ namespace PowerLauncher.ViewModel
|
||||
{
|
||||
// todo: revert _userSelectedRecordStorage.Save() and _historyItemsStorage.Save() after https://github.com/microsoft/PowerToys/issues/9164 is done
|
||||
_userSelectedRecord.Add(result);
|
||||
_userSelectedRecordStorage.Save();
|
||||
try
|
||||
{
|
||||
_userSelectedRecordStorage.Save();
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
Log.Warn($"Failed to save file. ${ex.Message}", this.GetType());
|
||||
}
|
||||
|
||||
_history.Add(result.OriginQuery.RawQuery);
|
||||
_historyItemsStorage.Save();
|
||||
try
|
||||
{
|
||||
_historyItemsStorage.Save();
|
||||
}
|
||||
catch (UnauthorizedAccessException ex)
|
||||
{
|
||||
Log.Warn($"Failed to save file. ${ex.Message}", this.GetType());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user