Skip to content

Fix: Fixed NullReferenceException in LaunchPreviewPopupAction #14211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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