diff --git a/src/sbbs3/js_console.cpp b/src/sbbs3/js_console.cpp index 26eaacaabe50ee3f68c49e455783b5a25ad714bc..ef3283854c6becdeaf0b7e231a754d54feaef9ed 100644 --- a/src/sbbs3/js_console.cpp +++ b/src/sbbs3/js_console.cpp @@ -307,7 +307,8 @@ js_handle_ctrlkey(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval * if((js_str=JS_ValueToString(cx, argv[0]))==NULL) return(JS_FALSE); - JS_ValueToInt32(cx, argv[1], &mode); + if(argc>1) + JS_ValueToInt32(cx, argv[1], &mode); *rval = BOOLEAN_TO_JSVAL(sbbs->handle_ctrlkey(*JS_GetStringBytes(js_str),mode)); return(JS_TRUE); @@ -1164,7 +1165,7 @@ static jsMethodSpec js_console_functions[] = { {"telnet_cmd", js_telnet_cmd, 2, JSTYPE_VOID, JSDOCSTR("number cmd [,number option]") ,JSDOCSTR("Send telnet command (with optional command option) to remote client") }, - {"handle_ctrlkey", js_handle_ctrlkey, 2, JSTYPE_BOOLEAN, JSDOCSTR("string key [,number mode]") + {"handle_ctrlkey", js_handle_ctrlkey, 1, JSTYPE_BOOLEAN, JSDOCSTR("string key [,number mode]") ,JSDOCSTR("Call internal control key handler for specified control key, returns true if handled") }, {0}