1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

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.
This commit is contained in:
Miciah Dashiel Butler Masters 2006-01-02 18:52:26 +00:00 committed by Jonas Fonseca
parent 9d287c24ae
commit d4cceb5f0e

View File

@ -14,6 +14,7 @@
#include "scripting/smjs/elinks_object.h" #include "scripting/smjs/elinks_object.h"
#include "scripting/smjs/global_object.h" #include "scripting/smjs/global_object.h"
#include "scripting/smjs/smjs.h" #include "scripting/smjs/smjs.h"
#include "util/file.h"
#include "util/string.h" #include "util/string.h"
@ -116,7 +117,8 @@ smjs_load_hooks(void)
path = stracpy(CONFDIR "/" SMJS_HOOKS_FILENAME); path = stracpy(CONFDIR "/" SMJS_HOOKS_FILENAME);
} }
smjs_do_file(path); if (file_exists(path))
smjs_do_file(path);
mem_free(path); mem_free(path);
} }