Add some checks

This commit is contained in:
de4dot 2012-01-14 12:19:17 +01:00
parent 7b93497bc6
commit 5e3b4a1414

View File

@ -17,6 +17,7 @@
along with de4dot. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
using System.Collections.Generic;
using Mono.Cecil;
using Mono.Cecil.Cil;
@ -43,6 +44,10 @@ namespace de4dot.code.deobfuscators {
}
public void add(MethodDefinition method, Func<MethodDefinition, object[], TValue> handler) {
if (method == null)
return;
if (decrypterMethods.find(method) != null)
throw new ApplicationException(string.Format("Handler for method {0:X8} has already been added", method.MetadataToken.ToInt32()));
if (method != null)
decrypterMethods.add(method, handler);
}