Fixed an exception that occurs when a VFX Graph window is open and the open VFX Graph asset is searched for references (there may be other similar edge cases, as well)

This commit is contained in:
yasirkula
2023-05-07 21:37:38 +03:00
parent 8441e4701c
commit f6a999f053
@@ -985,9 +985,13 @@ namespace AssetUsageDetectorNamespace
if( obj == null || obj.Equals( null ) )
return null;
// Avoid recursion (which leads to stackoverflow exception) using a stack
if( callStack.ContainsFast( obj ) )
return null;
// Avoid recursion (which leads to stackoverflow exception) using a stack (initially, I was using callStack.ContainsFast
// here but it returned false for objects that do exist in the call stack if VFX Graph window was open)
for( int i = callStack.Count - 1; i >= 0; i-- )
{
if( callStack[i].Equals( obj ) )
return null;
}
bool searchingSourceAsset = searchingSourceAssets && ReferenceEquals( currentSearchedObject, obj );