From 97b5b9cfe1a6a9b6e2f08d29003615be958148df Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Mon, 2 Jan 2006 18:52:26 +0000 Subject: [PATCH] Check for hooks.js before trying to load it. Check file_exists(path) before calling smjs_do_file(path) in smjs_load_hooks to fix an error message when there is no hooks.js, reported by zas. --- src/scripting/smjs/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scripting/smjs/core.c b/src/scripting/smjs/core.c index a526ebb99..755330039 100644 --- a/src/scripting/smjs/core.c +++ b/src/scripting/smjs/core.c @@ -14,6 +14,7 @@ #include "scripting/smjs/elinks_object.h" #include "scripting/smjs/global_object.h" #include "scripting/smjs/smjs.h" +#include "util/file.h" #include "util/string.h" @@ -116,7 +117,8 @@ smjs_load_hooks(void) path = stracpy(CONFDIR "/" SMJS_HOOKS_FILENAME); } - smjs_do_file(path); + if (file_exists(path)) + smjs_do_file(path); mem_free(path); }