mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 11:17:53 +01:00
Add null check for WindowsXamlHost_ChildChanged handler (#7426)
This commit is contained in:
@@ -30,6 +30,12 @@ namespace Microsoft.PowerToys.Settings.UI.Runner
|
|||||||
|
|
||||||
private void WindowsXamlHost_ChildChanged(object sender, EventArgs e)
|
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.
|
// Hook up x:Bind source.
|
||||||
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
|
WindowsXamlHost windowsXamlHost = sender as WindowsXamlHost;
|
||||||
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
|
ShellPage shellPage = windowsXamlHost.GetUwpInternalObject() as ShellPage;
|
||||||
|
|||||||
Reference in New Issue
Block a user