Compare commits

...

1 Commits

Author SHA1 Message Date
Muyuan Li (from Dev Box)
12e9ee42ca fix(Settings): handle null Exception in Frame_NavigationFailed to prevent NullReferenceException
When NavigationFailedEventArgs.Exception is null, the original code threw a
NullReferenceException instead of a meaningful error. Use null-coalescing to
throw an InvalidOperationException with context about the failed page.
2026-04-29 17:56:18 +08:00

View File

@@ -135,7 +135,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private void Frame_NavigationFailed(object sender, NavigationFailedEventArgs e)
{
throw e.Exception;
throw e.Exception ?? new InvalidOperationException(
$"Navigation to {e.SourcePageType?.FullName ?? "unknown page"} failed.");
}
private void Frame_Navigated(object sender, NavigationEventArgs e)