Fix potential incorrect null checks in FlaxEngine.Objects

The null-conditional operator checks for reference equality of the
Object, but doesn't check the validity of the unmanaged pointer. This
check is corrected in cases where the object was not immediately
returned from the bindings layer and may have been destroyed earlier.
This commit is contained in:
2023-09-25 23:06:14 +03:00
parent ea201b6173
commit 58445f04c4
18 changed files with 42 additions and 35 deletions

View File

@@ -576,8 +576,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
return;
for (int j = 0; j < e.Length; j++)
{
var t1 = scripts[j]?.TypeName;
var t2 = e[j]?.TypeName;
var t1 = scripts[j] != null ? scripts[j].TypeName : null;
var t2 = e[j] != null ? e[j].TypeName : null;
if (t1 != t2)
return;
}