Fix panic on `-e` option
@@ -17,6 +17,10 @@ func InitIssueReportVM(dir string, args []string) (*VM, error) {
// PrintError prints an error report string given a vm which evaluated to and Error object
func PrintError(v *VM) {
+ if v.mainThread.stack.top() == nil {
+ fmt.Println("No error detected: stack empty")
+ return
+ }
eval := v.mainThread.stack.top().Target
err, ok := eval.(*Error)
if !ok {
