#fixed code
                              @Test(expectedExceptions = UnexpectedAlertOpen.class)
  public void cannotInteractWithAppWhenAlertOpen() throws Exception {
    RemoteUIADriver driver = null;
    try {

      driver = getDriver();
      RemoteUIATarget target = driver.getLocalTarget();
      RemoteUIAApplication app = target.getFrontMostApp();
      RemoteUIAWindow win = app.getMainWindow();
      getAlert(win);

      Criteria c =
          new AndCriteria(new TypeCriteria(UIAStaticText.class), new NameCriteria("Show Simple"));
      UIAElement el = win.findElements(c).get(1);
      // opens an alert.
      el.tap();
      // should throw.The alert prevent interacting with the background.
      el.tap();

    } finally {
      if (driver != null) {
        driver.quit();
      }
    }
  }
#vulnerable code 
                              @Test(expectedExceptions = UnexpectedAlertOpen.class)
  public void cannotInteractWithAppWhenAlertOpen() throws Exception {
    RemoteUIADriver driver = null;
    try {

      driver = getDriver();
      RemoteUIATarget target = driver.getLocalTarget();
      RemoteUIAApplication app = target.getFrontMostApp();
      RemoteUIAWindow win = app.getMainWindow();
      getAlert(win);

      UIAElement el = win.findElements(new NameCriteria("Show Simple")).get(2);
      // opens an alert.
      el.tap();
      // should throw.The alert prevent interacting with the background.
      el.tap();



    } finally {
      if (driver != null) {
        driver.quit();
      }
    }
  } 
                            #location 12 
                            #vulnerability type NULL_DEREFERENCE