Skip to content

Commit

Permalink
Fix: Fixed NullReferenceException in LaunchPreviewPopupAction (files-…
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu authored Dec 10, 2023
1 parent f5e907f commit 0ccf13e
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public async Task ExecuteAsync()
if (provider is null)
return;

await provider.TogglePreviewPopupAsync(context.SelectedItem!.ItemPath);
var itemPath = context.SelectedItem?.ItemPath;
if (itemPath is not null)
await provider.TogglePreviewPopupAsync(itemPath);
}

private async Task SwitchPopupPreviewAsync()
Expand All @@ -48,17 +50,19 @@ private async Task SwitchPopupPreviewAsync()
if (provider is null)
return;

await provider.SwitchPreviewAsync(context.SelectedItem!.ItemPath);
var itemPath = context.SelectedItem?.ItemPath;
if (itemPath is not null)
await provider.SwitchPreviewAsync(itemPath);
}
}

public void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
public async void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(IContentPageContext.SelectedItems):
OnPropertyChanged(nameof(IsExecutable));
var _ = SwitchPopupPreviewAsync();
await SwitchPopupPreviewAsync();
break;
}
}
Expand Down

0 comments on commit 0ccf13e

Please sign in to comment.