From 55401a447ff2c478f37287d30fc24e036a131b45 Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Tue, 23 Feb 2021 23:44:07 +0100 Subject: [PATCH] Formats: Don't crash on secondary load strategies with existing type mappings (#140) --- Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs index 389e60e..77e54ea 100644 --- a/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs +++ b/Il2CppInspector.Common/IL2CPP/Il2CppBinary.cs @@ -121,8 +121,12 @@ namespace Il2CppInspector // Set width of long (convert to sizeof(int) for 32-bit files) if (stream[0].Bits == 32) { - stream[0].AddPrimitiveMapping(typeof(long), typeof(int)); - stream[0].AddPrimitiveMapping(typeof(ulong), typeof(uint)); + try { + stream[0].AddPrimitiveMapping(typeof(long), typeof(int)); + } catch (ArgumentException) { } + try { + stream[0].AddPrimitiveMapping(typeof(ulong), typeof(uint)); + } catch (ArgumentException) { } } return (Il2CppBinary) Activator.CreateInstance(type, stream[0], statusCallback);