Skip to content

Commit

Permalink
fix ending of script without RET
Browse files Browse the repository at this point in the history
  • Loading branch information
Hecate2 committed Jul 18, 2023
1 parent 7681b7c commit a81dd92
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Fairy.Debugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,14 @@ private FairyEngine ExecuteAndCheck(FairyEngine engine, out BreakReason actualBr
actualBreakReason = BreakReason.None;
if (engine.State == VMState.HALT || engine.State == VMState.FAULT)
return engine;
OpCode currentOpCode = engine.CurrentContext.CurrentInstruction.OpCode;
Instruction currentInstruction = engine.CurrentContext.CurrentInstruction ?? Instruction.RET;
OpCode currentOpCode = currentInstruction.OpCode;
if ((requiredBreakReason & BreakReason.Call) > 0 &&
(currentOpCode == OpCode.CALL || currentOpCode == OpCode.CALLA || currentOpCode == OpCode.CALLT || currentOpCode == OpCode.CALL_L
|| (currentOpCode == OpCode.SYSCALL && engine.CurrentContext.CurrentInstruction.TokenU32 == ApplicationEngine.System_Contract_Call.Hash)))
|| (currentOpCode == OpCode.SYSCALL && currentInstruction.TokenU32 == ApplicationEngine.System_Contract_Call.Hash)))
{
engine.ExecuteNext();
if (engine.CurrentContext.CurrentInstruction.OpCode == OpCode.INITSLOT)
if (currentInstruction.OpCode == OpCode.INITSLOT)
engine.ExecuteNext();
else
return engine;
Expand Down

0 comments on commit a81dd92

Please sign in to comment.