From 3440f794211acc14e77e69934e6afd204878e87e Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 26 Sep 2022 12:49:10 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E5=A4=8DResolveClass=E6=9F=90?= =?UTF-8?q?=E4=BA=9B=E6=83=85=E5=86=B5=E4=B8=8B=E6=8A=9B=E5=87=BANullRefer?= =?UTF-8?q?enceException=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Meta/GenericClass.cs | 6 ++++++ Editor/Meta/GenericMethod.cs | 2 ++ 2 files changed, 8 insertions(+) diff --git a/Editor/Meta/GenericClass.cs b/Editor/Meta/GenericClass.cs index d10c16e..746b7aa 100644 --- a/Editor/Meta/GenericClass.cs +++ b/Editor/Meta/GenericClass.cs @@ -1,6 +1,7 @@ using dnlib.DotNet; using System.Collections.Generic; using System.Linq; +using UnityEngine; namespace HybridCLR.Editor.Meta { @@ -61,6 +62,11 @@ namespace HybridCLR.Editor.Meta return null; } TypeDef def = type.ResolveTypeDef(); + if (def == null) + { + Debug.LogError($"type:{type} ResolveTypeDef() == null"); + return null; + } var klassInst = ctx != null ? sig.GenericArguments.Select(ga => MetaUtil.Inflate(ga, ctx)).ToList() : sig.GenericArguments.ToList(); return new GenericClass(def, klassInst); } diff --git a/Editor/Meta/GenericMethod.cs b/Editor/Meta/GenericMethod.cs index 9989209..a725db7 100644 --- a/Editor/Meta/GenericMethod.cs +++ b/Editor/Meta/GenericMethod.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; +using UnityEngine; namespace HybridCLR.Editor.Meta { @@ -87,6 +88,7 @@ namespace HybridCLR.Editor.Meta methodDef = method.ResolveMethodDef(); if (methodDef == null) { + Debug.LogError($"method:{method} ResolveMethodDef() == null"); return null; } if (method is MethodSpec methodSpec)