Fix exception on engine closing in some cases

This commit is contained in:
Wojtek Figat
2021-03-17 11:12:20 +01:00
parent 8fb27e6f83
commit aa1c200bf8

View File

@@ -1166,7 +1166,7 @@ namespace FlaxEditor
if (Windows.GameWin != null && Windows.GameWin.ContainsFocus)
{
var win = Windows.GameWin.Root;
if (win != null && win.RootWindow is WindowRootControl root && root.Window.IsFocused)
if (win?.RootWindow is WindowRootControl root && root.Window && root.Window.IsFocused)
{
return true;
}
@@ -1179,7 +1179,7 @@ namespace FlaxEditor
if (Windows.GameWin != null && Windows.GameWin.ContainsFocus)
{
var win = Windows.GameWin.Root;
if (win != null && win.RootWindow is WindowRootControl root && root.Window.IsFocused)
if (win?.RootWindow is WindowRootControl root && root.Window && root.Window.IsFocused)
{
pos = Vector2.Round(Windows.GameWin.Viewport.PointFromScreen(pos) * root.DpiScale);
}
@@ -1199,7 +1199,7 @@ namespace FlaxEditor
if (Windows.GameWin != null && Windows.GameWin.ContainsFocus)
{
var win = Windows.GameWin.Root;
if (win != null && win.RootWindow is WindowRootControl root && root.Window.IsFocused)
if (win?.RootWindow is WindowRootControl root && root.Window && root.Window.IsFocused)
{
pos = Vector2.Round(Windows.GameWin.Viewport.PointToScreen(pos / root.DpiScale));
}