Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: JSMenu.cpp
- ===================================================================
- --- JSMenu.cpp (revision 984)
- +++ JSMenu.cpp (working copy)
- @@ -255,19 +255,20 @@
- {
- // validate the args...
- char *profile, *mode, *gateway, *username, *password, *charname;
- - if(argc != 6)
- + int spdifficulty = 3;
- + if(argc < 6 || argc > 7)
- THROW_ERROR(cx, "Invalid arguments passed to addProfile");
- - for(uintN i = 0; i < argc; i++)
- + char* args[] = {&profile, &mode, &gateway, &username, &password, &charname};
- + for(uintN i = 0; i < 7; i++)
- if(!JSVAL_IS_STRING(argv[i]))
- - THROW_ERROR(cx, "All arguments to addProfile must be strings!");
- + THROW_ERROR(cx, "Invalid argument passed to addProfile");
- + else
- + args[i] = JS_GetStringBytes(JSVAL_TO_STRING(argv[i]));
- - profile = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
- - mode = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
- - gateway = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
- - username = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
- - password = JS_GetStringBytes(JSVAL_TO_STRING(argv[4]));
- - charname = JS_GetStringBytes(JSVAL_TO_STRING(argv[5]));
- + if(argc == 7)
- + spdifficulty = JSVAL_TO_INT(argv[6]);
- +
- if(!profile || !mode || !gateway || !username || !password || !charname)
- THROW_ERROR(cx, "Failed to convert string");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement