From 4ee7f749ab1aeb781b2d1cb93730fbc08f9d7e6d Mon Sep 17 00:00:00 2001 From: a180285 Date: Wed, 7 Jul 2021 17:21:26 +0800 Subject: [PATCH] Add more error info when method not found --- Confuser.Renamer/VTable.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Confuser.Renamer/VTable.cs b/Confuser.Renamer/VTable.cs index 644b21aa..a1fe8f21 100644 --- a/Confuser.Renamer/VTable.cs +++ b/Confuser.Renamer/VTable.cs @@ -227,7 +227,10 @@ public static VTable ConstructVTable(TypeDef typeDef, VTableStorage storage) { }); } else { - var targetSlot = vTbl.AllSlots.Single(slot => slot.MethodDef == targetMethod); + var targetSlot = vTbl.AllSlots.SingleOrDefault(slot => slot.MethodDef == targetMethod); + if (targetSlot == null) { + throw new Exception($"method [{method}] not found."); + } CheckKeyExist(storage, vTbl.SlotsMap, targetSlot.Signature, "MethodImpl Normal Sig"); targetSlot = vTbl.SlotsMap[targetSlot.Signature]; // Use the most derived slot // Maybe implemented by above processes --- this process should take priority