Fix getting Control from null ControlReference

#3123
This commit is contained in:
Wojtek Figat
2025-03-04 22:12:35 +01:00
parent 00202b06a4
commit 5ffa3eb837

View File

@@ -43,9 +43,11 @@ namespace FlaxEngine
{
get
{
if (_uiControl != null && _uiControl.Control is T t)
if (_uiControl == null)
return null;
if (_uiControl.Control is T t)
return t;
Debug.Write(LogType.Warning, "Trying to get Control from ControlReference but UIControl is null, or UIControl.Control is null, or UIControl.Control is not the correct type.");
Debug.Write(LogType.Warning, "Trying to get Control from ControlReference but UIControl.Control is null, or the correct type.");
return null;
}
}
@@ -66,7 +68,7 @@ namespace FlaxEngine
}
else
{
Debug.Write(LogType.Warning, "Trying to set ControlReference but UIControl.Control is null or UIControl.Control is not the correct type.");
Debug.Write(LogType.Warning, "Trying to set UIControl but UIControl.Control is null or not the correct type.");
}
}
}