Advertisement
Guest User

Untitled

a guest
May 2nd, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. Index: JSMenu.cpp
  2. ===================================================================
  3. --- JSMenu.cpp (revision 984)
  4. +++ JSMenu.cpp (working copy)
  5. @@ -255,19 +255,20 @@
  6. {
  7. // validate the args...
  8. char *profile, *mode, *gateway, *username, *password, *charname;
  9. - if(argc != 6)
  10. + int spdifficulty = 3;
  11. + if(argc < 6 || argc > 7)
  12. THROW_ERROR(cx, "Invalid arguments passed to addProfile");
  13.  
  14. - for(uintN i = 0; i < argc; i++)
  15. + char* args[] = {&profile, &mode, &gateway, &username, &password, &charname};
  16. + for(uintN i = 0; i < 7; i++)
  17. if(!JSVAL_IS_STRING(argv[i]))
  18. - THROW_ERROR(cx, "All arguments to addProfile must be strings!");
  19. + THROW_ERROR(cx, "Invalid argument passed to addProfile");
  20. + else
  21. + args[i] = JS_GetStringBytes(JSVAL_TO_STRING(argv[i]));
  22.  
  23. - profile = JS_GetStringBytes(JSVAL_TO_STRING(argv[0]));
  24. - mode = JS_GetStringBytes(JSVAL_TO_STRING(argv[1]));
  25. - gateway = JS_GetStringBytes(JSVAL_TO_STRING(argv[2]));
  26. - username = JS_GetStringBytes(JSVAL_TO_STRING(argv[3]));
  27. - password = JS_GetStringBytes(JSVAL_TO_STRING(argv[4]));
  28. - charname = JS_GetStringBytes(JSVAL_TO_STRING(argv[5]));
  29. + if(argc == 7)
  30. + spdifficulty = JSVAL_TO_INT(argv[6]);
  31. +
  32. if(!profile || !mode || !gateway || !username || !password || !charname)
  33. THROW_ERROR(cx, "Failed to convert string");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement