never check args.length and args != null on the same line

Former-commit-id: b3fba0449c
Former-commit-id: 2e0110d5350c23504de42b64b16953f6c182a0b1
This commit is contained in:
idk
2022-09-03 21:38:20 -04:00
parent 0e6da3bb26
commit bcd932c726
4 changed files with 94 additions and 69 deletions

View File

@ -192,10 +192,13 @@ public class I2PGenericUnsafeBrowser extends I2PCommonBrowser {
public ProcessBuilder baseProcessBuilder(String[] args) {
String browser = findUnsafeBrowserAnywhere();
if (!browser.isEmpty()) {
String[] newArgs = new String[args.length + 1];
int arglength = 0;
if (args != null)
arglength = args.length;
String[] newArgs = new String[arglength + 1];
newArgs[0] = browser;
if (args != null && args.length > 0) {
for (int i = 0; i < args.length; i++) {
if (args != null && arglength > 0) {
for (int i = 0; i < arglength; i++) {
newArgs[i + 1] = args[i];
}
}
@ -394,16 +397,18 @@ public class I2PGenericUnsafeBrowser extends I2PCommonBrowser {
boolean privateBrowsing = false;
System.out.println("checking for private browsing");
ArrayList<String> visitURL = new ArrayList<String>();
if (args != null && args.length > 0) {
for (String arg : args) {
if (arg.equals("-private")) {
privateBrowsing = true;
System.out.println(
"private browsing is true, profile will be discarded at end of session");
}
if (!arg.startsWith("-")) {
// check if it's a URL
visitURL.add(ValidURL(arg));
if (args != null) {
if (args.length > 0) {
for (String arg : args) {
if (arg.equals("-private")) {
privateBrowsing = true;
System.out.println(
"private browsing is true, profile will be discarded at end of session");
}
if (!arg.startsWith("-")) {
// check if it's a URL
visitURL.add(ValidURL(arg));
}
}
}
}