Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 0b97339

Browse files
committed
Cleanup
1 parent 701d443 commit 0b97339

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Core/Reflection/Il2CppReflection.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ protected override void Initialize()
4444

4545
public static bool Il2CppTypeNotNull(Type type, out IntPtr il2cppPtr)
4646
{
47-
if (cppClassPointers.TryGetValue(type.AssemblyQualifiedName, out il2cppPtr))
48-
return il2cppPtr != IntPtr.Zero;
49-
50-
il2cppPtr = (IntPtr)typeof(Il2CppClassPointerStore<>)
47+
if (!cppClassPointers.TryGetValue(type.AssemblyQualifiedName, out il2cppPtr))
48+
{
49+
il2cppPtr = (IntPtr)typeof(Il2CppClassPointerStore<>)
5150
.MakeGenericType(new Type[] { type })
5251
.GetField("NativeClassPtr", BF.Public | BF.Static)
5352
.GetValue(null);
5453

55-
cppClassPointers.Add(type.AssemblyQualifiedName, il2cppPtr);
54+
cppClassPointers.Add(type.AssemblyQualifiedName, il2cppPtr);
55+
}
5656

5757
return il2cppPtr != IntPtr.Zero;
5858
}
@@ -242,11 +242,11 @@ internal override object Internal_TryCast(object obj, Type castTo)
242242
else if (castTo == typeof(string))
243243
return UnboxString(obj);
244244

245-
// Casting from il2cpp object to il2cpp object...
246-
247245
if (!Il2CppTypeNotNull(castTo, out IntPtr castToPtr))
248246
return obj;
249247

248+
// Casting from il2cpp object to il2cpp object...
249+
250250
IntPtr castFromPtr = il2cpp_object_get_class(cppObj.Pointer);
251251

252252
if (!il2cpp_class_is_assignable_from(castToPtr, castFromPtr))

0 commit comments

Comments
 (0)