From 5a849c77d95f0c053f92b0b2f891ad42891a75dc Mon Sep 17 00:00:00 2001 From: yck1509 Date: Thu, 19 Nov 2015 03:11:08 +0800 Subject: [PATCH] Improve exception message when protection not found --- Confuser.Core/ObfAttrParser.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Confuser.Core/ObfAttrParser.cs b/Confuser.Core/ObfAttrParser.cs index 702cba695..5d7dbe61c 100644 --- a/Confuser.Core/ObfAttrParser.cs +++ b/Confuser.Core/ObfAttrParser.cs @@ -202,6 +202,9 @@ public void ParseProtectionString(ProtectionSettings settings, string str) { case ParseState.EndItem: if (settings != null) { + if (!items.Contains(protId)) + throw new KeyNotFoundException("Cannot find protection with id '" + protId + "'."); + if (protAct) { settings[(Protection)items[protId]] = protParams; } @@ -243,7 +246,11 @@ public void ParsePackerString(string str, out Packer packer, out Dictionary