From 4340cf8637a77bd17f8655c158dd809f31fe0720 Mon Sep 17 00:00:00 2001 From: ShawnYun Date: Tue, 23 Jun 2020 16:38:28 +0800 Subject: [PATCH] fix ret bug (#307) --- src/Neo.Compiler.MSIL/MSIL/Converter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Neo.Compiler.MSIL/MSIL/Converter.cs b/src/Neo.Compiler.MSIL/MSIL/Converter.cs index fa9ae64e2..47a5a892f 100644 --- a/src/Neo.Compiler.MSIL/MSIL/Converter.cs +++ b/src/Neo.Compiler.MSIL/MSIL/Converter.cs @@ -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); @@ -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);