Fix crash in value comparison for deleted native scripting object that still has managed reference

#3365 #3374
This commit is contained in:
Wojtek Figat
2025-04-13 22:13:17 +02:00
parent a3be6e2add
commit cfc90d1ddf

View File

@@ -265,7 +265,7 @@ namespace FlaxEngine.Json
// Special case when saving reference to prefab object and the objects are different but the point to the same prefab object
// In that case, skip saving reference as it's defined in prefab (will be populated via IdsMapping during deserialization)
if (objA is SceneObject sceneA && objB is SceneObject sceneB && sceneA.HasPrefabLink && sceneB.HasPrefabLink)
if (objA is SceneObject sceneA && objB is SceneObject sceneB && sceneA && sceneB && sceneA.HasPrefabLink && sceneB.HasPrefabLink)
return sceneA.PrefabObjectID == sceneB.PrefabObjectID;
// Comparing an Int32 and Int64 both of the same value returns false, make types the same then compare