Program: 44986
Project: 44986
Buggy source:
private boolean openBank(){
  try {
    if (!bank.isOpen()) {
      if (menu.isOpen()) {
        mouse.moveSlightly();
        sleep(random(40,60));
      }
      RSObject bankBooth=objects.getNearest(bank.BANK_BOOTHS);
      RSNPC banker=npcs.getNearest(bank.BANKERS);
      RSObject bankChest=objects.getNearest(bank.BANK_CHESTS);
      int dist=calc.distanceTo(bankBooth);
      if (banker != null && bankBooth != null && calc.distanceTo(banker) < dist) {
        if (calc.distanceBetween(banker.getLocation(),bankBooth.getLocation()) <= 1) {
          if (random(1,3) >= 2) {
            banker=null;
          }
 else {
            bankBooth=null;
          }
        }
 else {
          bankBooth=null;
        }
      }
      if (bankChest != null && calc.distanceTo(bankChest) < dist) {
        bankBooth=null;
        banker=null;
      }
      if (((bankBooth != null) && (calc.distanceTo(bankBooth) < 5) && calc.tileOnMap(bankBooth.getLocation())&& calc.canReach(bankBooth.getLocation(),true)) || ((banker != null) && (calc.distanceTo(banker) < 8) && calc.tileOnMap(banker.getLocation())&& calc.canReach(banker.getLocation(),true)) || ((bankChest != null) && (calc.distanceTo(bankChest) < 8) && calc.tileOnMap(bankChest.getLocation())&& calc.canReach(bankChest.getLocation(),true)&& !bank.isOpen())) {
        if (bankBooth != null) {
          Point loc=getLocation(bankBooth);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(bankBooth);
          }
        }
 else         if (banker != null) {
          RSModel m=banker.getModel();
          if (m == null) {
            m=banker.getModel();
            if (m == null) {
              return false;
            }
          }
          Point loc=pointOnScreen(m);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(banker);
          }
        }
 else         if (bankChest != null) {
          Point loc=getLocation(bankChest);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str") && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str") || doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(bankBooth);
          }
        }
      }
 else {
        if (bankBooth != null) {
          walking.walkTo(bankBooth.getLocation());
        }
 else         if (banker != null) {
          walking.walkTo(banker.getLocation());
        }
 else         if (bankChest != null) {
          walking.walkTo(bankChest.getLocation());
        }
 else {
          return false;
        }
      }
    }
    return bank.isOpen();
  }
 catch (  Exception e) {
    return false;
  }
}

Fixed version (ground truth):
private boolean openBank(){
  try {
    if (!bank.isOpen()) {
      if (menu.isOpen()) {
        mouse.moveSlightly();
        sleep(random(40,60));
      }
      RSObject bankBooth=objects.getNearest(Bank.BANK_BOOTHS);
      RSNPC banker=npcs.getNearest(Bank.BANKERS);
      RSObject bankChest=objects.getNearest(Bank.BANK_CHESTS);
      int dist=calc.distanceTo(bankBooth);
      if (banker != null && bankBooth != null && calc.distanceTo(banker) < dist) {
        if (calc.distanceBetween(banker.getLocation(),bankBooth.getLocation()) <= 1) {
          if (random(1,3) >= 2) {
            banker=null;
          }
 else {
            bankBooth=null;
          }
        }
 else {
          bankBooth=null;
        }
      }
      if (bankChest != null && calc.distanceTo(bankChest) < dist) {
        bankBooth=null;
        banker=null;
      }
      if (((bankBooth != null) && (calc.distanceTo(bankBooth) < 5) && calc.tileOnMap(bankBooth.getLocation())&& calc.canReach(bankBooth.getLocation(),true)) || ((banker != null) && (calc.distanceTo(banker) < 8) && calc.tileOnMap(banker.getLocation())&& calc.canReach(banker.getLocation(),true)) || ((bankChest != null) && (calc.distanceTo(bankChest) < 8) && calc.tileOnMap(bankChest.getLocation())&& calc.canReach(bankChest.getLocation(),true)&& !bank.isOpen())) {
        if (bankBooth != null) {
          Point loc=getLocation(bankBooth);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(bankBooth);
          }
        }
 else         if (banker != null) {
          RSModel m=banker.getModel();
          if (m == null) {
            m=banker.getModel();
            if (m == null) {
              return false;
            }
          }
          Point loc=pointOnScreen(m);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(banker);
          }
        }
 else         if (bankChest != null) {
          Point loc=getLocation(bankChest);
          for (int i=0; i < 10 && !menu.contains("String_Node_Str") && !menu.contains("String_Node_Str"); i++) {
            mouseMove(loc);
            if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
              sleep(random(20,60));
              if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
                sleep(random(20,60));
                if (menu.contains("String_Node_Str") || menu.contains("String_Node_Str")) {
                  break;
                }
              }
            }
          }
          if (doMenuAction("String_Node_Str") || doMenuAction("String_Node_Str")) {
            int count=0;
            while (!bank.isOpen() && ++count <= 10) {
              sleep(random(200,300));
              if (getMyPlayer().isMoving()) {
                count=0;
              }
            }
          }
 else {
            camera.turnTo(bankBooth);
          }
        }
      }
 else {
        if (bankBooth != null) {
          walking.walkTo(bankBooth.getLocation());
        }
 else         if (banker != null) {
          walking.walkTo(banker.getLocation());
        }
 else         if (bankChest != null) {
          walking.walkTo(bankChest.getLocation());
        }
 else {
          return false;
        }
      }
    }
    return bank.isOpen();
  }
 catch (  Exception e) {
    return false;
  }
}