From fd8330cca372701a0cb39e8d4e2585b0f8ee1eb6 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 27 Jul 2014 13:57:15 +0900 Subject: [PATCH] add eval error handling --- src/eval.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/eval.c b/src/eval.c index 579caa81..24807115 100644 --- a/src/eval.c +++ b/src/eval.c @@ -19,10 +19,15 @@ static pic_value pic_eval_eval(pic_state *pic) { pic_value program, spec; + struct pic_lib *lib; pic_get_args(pic, "oo", &program, &spec); - return pic_eval(pic, program, pic_find_library(pic, spec)); + lib = pic_find_library(pic, spec); + if (lib == NULL) { + pic_errorf(pic, "no library found: ~s", spec); + } + return pic_eval(pic, program, lib); } void