#vulnerable code 
                              public static void main(String[] args) throws FindFailed {

    System.out.println("********** Running Sikulix.main");

    int dl = RunTime.checkArgs(args, RunTime.Type.API);
    if (dl > -1 && dl < 999) {
      testNumber = dl;
      Debug.on(3);
    } else {
      testNumber = -1;
    }

    rt = RunTime.get();
    testNumber = rt.getOptionNumber("testing.test", -1);

    if (testNumber > -1) {
      rt = RunTime.get();
      if (!rt.testing) {
        rt.show();
        rt.testing = true;
      }
      Tests.runTest(testNumber);
      System.exit(1);
    } else {
      rt = RunTime.get();
      Debug.on(3);
      Settings.InfoLogs = false;
      Settings.ActionLogs = false;

			URL uTest = null;
			try {
        imgLink = "http://download.sikuli.de/images";
        imgHttp = "SikuliLogo.png";        
				uTest = new URL(imgLink);
				URL uImage = FileManager.getURLForContentFromURL(uTest, imgHttp);
        int retval;
        boolean ok = false;
        try {
          HttpURLConnection.setFollowRedirects(false);
          HttpURLConnection con = (HttpURLConnection) uImage.openConnection();
          con.setInstanceFollowRedirects(false);
          con.setRequestMethod("HEAD");
          retval = con.getResponseCode();
          ok = (retval == HttpURLConnection.HTTP_OK);
          log(0, "URL: %s (%d)", uImage, retval);
        } catch (Exception e) {
          log(-1, "%s", e);
          ok = false;
        }
        if (!ok) {
          System.exit(1);
        }
        BufferedImage bImg = ImageIO.read(uImage);
        if (bImg != null) {
          Image img = new Image(bImg);
          Screen scr = new Screen();
          scr.find(img).highlight(2);
          scr.find(img).highlight(2);
          Image.dump();
        }
			} catch (Exception ex) {
				log(-1, "%s", ex);
			}
      if (rt.runningWinApp) {
        popup("Hello World\nNot much else to do ( yet ;-)", rt.fSxBaseJar.getName());
        try {
        Screen scr = new Screen();
        scr.find(new Image(scr.userCapture("grab something to find"))).highlight(3);
        } catch (Exception ex) {
          popup("Uuups :-(\n" + ex.getMessage(), rt.fSxBaseJar.getName());
        }
        popup("Hello World\nNothing else to do ( yet ;-)", rt.fSxBaseJar.getName());
        System.exit(1);
      }
      rt.terminate(1,"Sikulix::main: nothing to test");
    }
  } 
                            #location 40 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              public static void main(String[] args) throws FindFailed {

    System.out.println("********** Running Sikulix.main");

    int dl = RunTime.checkArgs(args, RunTime.Type.API);
    if (dl > -1 && dl < 999) {
      testNumber = dl;
      Debug.on(3);
    } else {
      testNumber = -1;
    }

    rt = RunTime.get();
    testNumber = rt.getOptionNumber("testing.test", -1);

    if (testNumber > -1) {
      rt = RunTime.get();
      if (!rt.testing) {
        rt.show();
        rt.testing = true;
      }
      Tests.runTest(testNumber);
      System.exit(1);
    } else {
      rt = RunTime.get();
      Debug.on(3);
      Settings.InfoLogs = false;
      Settings.ActionLogs = false;

			URL uTest = null;
			try {
        imgLink = "http://download.sikuli.de/images";
				String imgFolder = "download.sikuli.de/images";
        imgHttp = "SikuliLogo.png";
				ImagePath.addHTTP(imgFolder);
				Image img = Image.create(imgHttp);
				Screen scr = new Screen();
				scr.find(img).highlight(2);
				scr.find(img).highlight(2);
				Image.dump();
			} catch (Exception ex) {
				log(-1, "%s", ex);
			}
      if (rt.runningWinApp) {
        popup("Hello World\nNot much else to do ( yet ;-)", rt.fSxBaseJar.getName());
        try {
        Screen scr = new Screen();
        scr.find(new Image(scr.userCapture("grab something to find"))).highlight(3);
        } catch (Exception ex) {
          popup("Uuups :-(\n" + ex.getMessage(), rt.fSxBaseJar.getName());
        }
        popup("Hello World\nNothing else to do ( yet ;-)", rt.fSxBaseJar.getName());
        System.exit(1);
      }
      rt.terminate(1,"Sikulix::main: nothing to test");
    }
  }