warn invalid application

This commit is contained in:
Yuichi Nishiwaki 2013-10-24 03:38:29 +09:00
parent d75b624b4a
commit a926c54be3
2 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,8 @@ struct pic_proc {
pic_value aux; pic_value aux;
}; };
#define pic_proc_p(o) (pic_type(o) == PIC_TT_PROC)
#define pic_proc_ptr(o) ((struct pic_proc *)(o).u.data) #define pic_proc_ptr(o) ((struct pic_proc *)(o).u.data)
#define pic_proc_cfunc_p(o) (pic_proc_ptr(o)->cfunc_p) #define pic_proc_cfunc_p(o) (pic_proc_ptr(o)->cfunc_p)

View File

@ -224,6 +224,10 @@ pic_run(pic_state *pic, struct pic_proc *proc, pic_value args)
struct pic_proc *proc; struct pic_proc *proc;
c = pic->sp[-pc->u.i]; c = pic->sp[-pc->u.i];
if (! pic_proc_p(c)) {
pic->errmsg = "invalid application";
goto L_RAISE;
}
proc = pic_proc_ptr(c); proc = pic_proc_ptr(c);
ci = PUSHCI(); ci = PUSHCI();