Skip to content

Commit adadbad

Browse files
kenbellaykevl
authored andcommitted
interp: improve unknown opcode handling
1 parent 58fafae commit adadbad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: interp/compiler.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ func (inst *instruction) String() string {
4949
operands[i] = op.String()
5050
}
5151

52-
name := instructionNameMap[inst.opcode]
52+
name := ""
53+
if int(inst.opcode) < len(instructionNameMap) {
54+
name = instructionNameMap[inst.opcode]
55+
}
5356
if name == "" {
5457
name = "<unknown op>"
5558
}

0 commit comments

Comments
 (0)