Fix crash when using generic interface in C#

#1983
This commit is contained in:
Wojtek Figat
2024-02-25 23:40:14 +01:00
parent 2df3d0f747
commit 8898c20ad1

View File

@@ -1679,6 +1679,8 @@ namespace FlaxEngine.Interop
/// </summary>
internal static ManagedHandle GetTypeManagedHandle(Type type)
{
if (type.IsInterface && type.IsGenericType)
type = type.GetGenericTypeDefinition(); // Generic type to use type definition handle
if (managedTypes.TryGetValue(type, out (TypeHolder typeHolder, ManagedHandle handle) tuple))
return tuple.handle;
#if FLAX_EDITOR