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:
@@ -151,7 +151,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._isolateIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._isolateIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
if (Window._skipEffectsGuiEvents)
|
||||
return;
|
||||
|
||||
Window._highlightIndex = mesh?.MaterialSlotIndex ?? -1;
|
||||
Window._highlightIndex = mesh != null ? mesh.MaterialSlotIndex : -1;
|
||||
Window.UpdateEffectsOnAsset();
|
||||
UpdateEffectsOnUI();
|
||||
}
|
||||
@@ -415,7 +415,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
[EditorOrder(10), EditorDisplay("Materials", EditorDisplayAttribute.InlineStyle)]
|
||||
public MaterialSlot[] MaterialSlots
|
||||
{
|
||||
get => Asset?.MaterialSlots;
|
||||
get => Asset != null ? Asset.MaterialSlots : null;
|
||||
set
|
||||
{
|
||||
if (Asset != null)
|
||||
|
||||
Reference in New Issue
Block a user