mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +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
|
// todo: revert _userSelectedRecordStorage.Save() and _historyItemsStorage.Save() after https://github.com/microsoft/PowerToys/issues/9164 is done
|
||||||
_userSelectedRecord.Add(result);
|
_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);
|
_history.Add(result.OriginQuery.RawQuery);
|
||||||
_historyItemsStorage.Save();
|
try
|
||||||
|
{
|
||||||
|
_historyItemsStorage.Save();
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException ex)
|
||||||
|
{
|
||||||
|
Log.Warn($"Failed to save file. ${ex.Message}", this.GetType());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user