#fixed code
                              public static void runscript(String[] args) {

    if (isRunningScript) {
      log(-1, "can run only one script at a time!");
      return;
    }

    IScriptRunner currentRunner = null;

    if (args != null && args.length > 1 && args[0].startsWith("-testSetup")) {
      currentRunner = getRunner(null, args[1]);
      if (currentRunner == null) {
        args[0] = null;
      } else {
        String[] stmts = new String[0];
        if (args.length > 2) {
          stmts = new String[args.length - 2];
          for (int i = 0; i < stmts.length; i++) {
            stmts[i] = args[i+2];
          }
        }
        if (0 != currentRunner.runScript(null, null, stmts, null)) {
          args[0] = null;
        }
      }
      isRunningScript = false;
      return;
    }

    runScripts = Runner.evalArgs(args);
    isRunningScript = true;

    if (runTime.runningInteractive) {
      int exitCode = 0;
      if (currentRunner == null) {
        String givenRunnerName = runTime.interactiveRunner;
        if (givenRunnerName == null) {
          currentRunner = getRunner(null, Runner.RDEFAULT);
        } else {
          currentRunner = getRunner(null, givenRunnerName);
        }
      }
      if (currentRunner == null) {
        System.exit(1);
      }
      exitCode = currentRunner.runInteractive(runTime.getSikuliArgs());
      currentRunner.close();
      Sikulix.endNormal(exitCode);
    }

		if (runScripts == null) {
			runTime.terminate(1, "option -r without any script");
		}

    if (runScripts.length > 0) {
			String scriptName = runScripts[0];
			if (scriptName != null && !scriptName.isEmpty() && scriptName.startsWith("git*")) {
				run(scriptName, runTime.getSikuliArgs());
				return;
			}
		}

    if (runScripts != null && runScripts.length > 0) {
      int exitCode = 0;
      runAsTest = runTime.runningTests;
      for (String givenScriptName : runScripts) {
        if (lastReturnCode == -1) {
          log(lvl, "Exit code -1: Terminating multi-script-run");
          break;
        }
        exitCode = new RunBox(givenScriptName, runTime.getSikuliArgs(), runAsTest).run();
        lastReturnCode = exitCode;
      }
      System.exit(exitCode);
    }
  }
#vulnerable code 
                              public static void runscript(String[] args) {

    if (isRunningScript) {
      log(-1, "can run only one script at a time!");
      return;
    }

    IScriptRunner currentRunner = null;

    if (args != null && args.length > 1 && args[0].startsWith("-testSetup")) {
      currentRunner = getRunner(null, args[1]);
      if (currentRunner == null) {
        args[0] = null;
      } else {
        String[] stmts = new String[0];
        if (args.length > 2) {
          stmts = new String[args.length - 2];
          for (int i = 0; i < stmts.length; i++) {
            stmts[i] = args[i+2];
          }
        }
        if (0 != currentRunner.runScript(null, null, stmts, null)) {
          args[0] = null;
        }
      }
      isRunningScript = false;
      return;
    }

    runScripts = Runner.evalArgs(args);
    isRunningScript = true;

    if (runTime.runningInteractive) {
      int exitCode = 0;
      if (currentRunner == null) {
        String givenRunnerName = runTime.interactiveRunner;
        if (givenRunnerName == null) {
          currentRunner = getRunner(null, Runner.RDEFAULT);
        } else {
          currentRunner = getRunner(null, givenRunnerName);
        }
      }
      if (currentRunner == null) {
        System.exit(1);
      }
      exitCode = currentRunner.runInteractive(runTime.getSikuliArgs());
      currentRunner.close();
      Sikulix.endNormal(exitCode);
    }

    if (runScripts.length > 0) {
			String scriptName = runScripts[0];
			if (scriptName != null && !scriptName.isEmpty() && scriptName.startsWith("git*")) {
				run(scriptName, runTime.getSikuliArgs());
				return;
			}
		}

    if (runScripts != null && runScripts.length > 0) {
      int exitCode = 0;
      runAsTest = runTime.runningTests;
      for (String givenScriptName : runScripts) {
        if (lastReturnCode == -1) {
          log(lvl, "Exit code -1: Terminating multi-script-run");
          break;
        }
        exitCode = new RunBox(givenScriptName, runTime.getSikuliArgs(), runAsTest).run();
        lastReturnCode = exitCode;
      }
      System.exit(exitCode);
    }
  } 
                            #location 51 
                            #vulnerability type NULL_DEREFERENCE