Skip to content

Commit

Permalink
fix ret bug (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawnYun authored Jun 23, 2020
1 parent 98c29df commit 4340cf8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Neo.Compiler.MSIL/MSIL/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public NeoModule Convert(ILModule _in, ConvOption option = null)
logger.Log("Insert _initialize().");
}

var attr = outModule.mapMethods.Values.Where(u => u.inSmartContract).Select(u => u.type.attributes.ToArray()).FirstOrDefault();
var attr = outModule.mapMethods.Values.Where(u => u.inSmartContract).Select(u => u.type?.attributes.ToArray()).FirstOrDefault();
if (attr?.Length > 0)
{
outModule.attributes.AddRange(attr);
Expand Down Expand Up @@ -431,8 +431,8 @@ private int ConvertCode(ILMethod method, OpCode src, NeoMethod to)
Convert1by1(VM.OpCode.NOP, src, to);
break;
case CodeEx.Ret:
//return was handled outside
Insert1(VM.OpCode.RET, null, to);
// return was handled outside
Convert1by1(VM.OpCode.RET, src, to);
break;
case CodeEx.Pop:
Convert1by1(VM.OpCode.DROP, src, to);
Expand Down

0 comments on commit 4340cf8

Please sign in to comment.