Add null check for WindowsXamlHost_ChildChanged handler (#7426)

This commit is contained in:
Arjun Balgovind
2020-10-20 12:50:04 -07:00
committed by GitHub
parent 51d6482ec2
commit 9a9424a975

View File

@@ -30,6 +30,12 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
{
// If sender is null, it could lead to a NullReferenceException. This might occur on restarting as admin (check https://github.com/microsoft/PowerToys/issues/7393 for details)
if (sender == null)
{
return;
}
// Hook up x:Bind source.
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;