Skip to content

Commit

Permalink
interp: improve unknown opcode handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kenbell authored and aykevl committed Sep 20, 2023
1 parent 58fafae commit adadbad
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion interp/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func (inst *instruction) String() string {
operands[i] = op.String()
}

name := instructionNameMap[inst.opcode]
name := ""
if int(inst.opcode) < len(instructionNameMap) {
name = instructionNameMap[inst.opcode]
}
if name == "" {
name = "<unknown op>"
}
Expand Down

0 comments on commit adadbad

Please sign in to comment.