From 7159bcd774d074453268bc227cd971ab189b30b5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 25 Jan 2014 15:00:29 +0100 Subject: [PATCH] Make sure to pop error object when we catch them at the top level dofile call. --- jsstate.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsstate.c b/jsstate.c index b90a092..9ff6658 100644 --- a/jsstate.c +++ b/jsstate.c @@ -73,6 +73,7 @@ int js_dostring(js_State *J, const char *source, int report) { if (js_try(J)) { fprintf(stderr, "libjs: %s\n", js_tostring(J, -1)); + js_pop(J, 1); return 1; } js_loadstring(J, "(string)", source); @@ -89,6 +90,7 @@ int js_dofile(js_State *J, const char *filename) { if (js_try(J)) { fprintf(stderr, "libjs: %s\n", js_tostring(J, -1)); + js_pop(J, 1); return 1; } js_loadfile(J, filename);