From ec1ab9fbe92cf308ce5cca7425691df04fe257ba Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Sat, 10 Jun 2006 18:09:31 +0000 Subject: [PATCH] SMJS: Better handle when the C code tries to call a badly defined method Before, when one assigned a value other than a function to elinks.preformat_html, elinks.goto_url_hook, or elinks.follow_url_hook, an assertion failure was triggered (and probably worse happened in non-DEBUG builds). Now just fail silently. --- src/scripting/smjs/elinks_object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/smjs/elinks_object.c b/src/scripting/smjs/elinks_object.c index 0018a1005..92d920026 100644 --- a/src/scripting/smjs/elinks_object.c +++ b/src/scripting/smjs/elinks_object.c @@ -180,7 +180,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, jsval argv[], int argc, return JS_FALSE; func = JS_ValueToFunction(smjs_ctx, *rval); - assert(func); + if (!func) return JS_FALSE; return JS_CallFunction(smjs_ctx, smjs_elinks_object, func, argc, argv, rval);