mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
[Peek] Handle crash when opening app for Internet shortcuts (#26680)
* null check * launch uri
This commit is contained in:
@@ -142,7 +142,14 @@ namespace Peek.UI.Views
|
||||
|
||||
PowerToysTelemetry.Log.WriteEvent(new OpenWithEvent() { App = DefaultAppName ?? string.Empty });
|
||||
|
||||
if (string.IsNullOrEmpty(DefaultAppName))
|
||||
// StorageFile objects can't represent files that are ".lnk", ".url", or ".wsh" file types.
|
||||
// https://learn.microsoft.com/en-us/uwp/api/windows.storage.storagefile?view=winrt-22621
|
||||
if (storageFile == null)
|
||||
{
|
||||
options.DisplayApplicationPicker = true;
|
||||
await Launcher.LaunchUriAsync(new Uri(Item.Path), options);
|
||||
}
|
||||
else if (string.IsNullOrEmpty(DefaultAppName))
|
||||
{
|
||||
// If there's no default app found, open the App picker
|
||||
options.DisplayApplicationPicker = true;
|
||||
|
||||
Reference in New Issue
Block a user