From bef47cbca345f339334050d71b5cd090fec3a94e Mon Sep 17 00:00:00 2001 From: lights Date: Thu, 30 Apr 2020 10:35:21 +0800 Subject: [PATCH] add commont for exception paramcount. --- src/Neo.Compiler.MSIL/MSIL/Conv_Multi.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Neo.Compiler.MSIL/MSIL/Conv_Multi.cs b/src/Neo.Compiler.MSIL/MSIL/Conv_Multi.cs index 0928d7e66..9eb505553 100644 --- a/src/Neo.Compiler.MSIL/MSIL/Conv_Multi.cs +++ b/src/Neo.Compiler.MSIL/MSIL/Conv_Multi.cs @@ -1314,16 +1314,16 @@ private int ConvertNewObj(ILMethod from, OpCode src, NeoMethod to) { // NeoVM `catch` instruction need one exception parameter Convert1by1(VM.OpCode.NOP, src, to); + var pcount = _type.Parameters.Count; + //pcount must be 1 + //if more then one, drop them. + //if pcount==0,add one. if (pcount == 0) // If there is no parameter, insert one pararmeter { ConvertPushString("usererror", src, to); } - else if (pcount == 1) - { - - } - else + else if (pcount > 1) { // Keep the first exception parameter for (var i = 0; i < pcount - 1; i++)