Program: 112477
Project: 112477
Buggy source:
/** 
 * Renders all options.
 * @param g the graphics context
 */
private void renderOptions(Graphics g){
  int y=(int)(-scrolling.getPosition() + optionStartY);
  maxScrollOffset=optionStartY;
  boolean render=true;
  int lastNonSkippedSectionIndex=0;
  int groupIndex=0;
  for (; groupIndex < groups.length; groupIndex++) {
    lastNonSkippedSectionIndex=groupIndex;
    OptionGroup section=groups[groupIndex];
    if (section.isFiltered()) {
      continue;
    }
    int lineStartY=(int)(y + Fonts.LARGE.getLineHeight() * 0.6f);
    if (render) {
      if (section.getOptions() == null) {
        Utils.drawRightAligned(Fonts.XLARGE,width,-paddingRight,(int)(y + Fonts.XLARGE.getLineHeight() * 0.3f),section.getName(),COL_CYAN);
      }
 else {
        Fonts.MEDIUMBOLD.drawString(paddingTextLeft,lineStartY,section.getName(),COL_WHITE);
      }
    }
    y+=Fonts.LARGE.getLineHeight() * 1.5f;
    maxScrollOffset+=Fonts.LARGE.getLineHeight() * 1.5f;
    if (section.getOptions() == null) {
      continue;
    }
    int lineHeight=(int)(Fonts.LARGE.getLineHeight() * 0.9f);
    for (int optionIndex=0; optionIndex < section.getOptions().length; optionIndex++) {
      GameOption option=section.getOptions()[optionIndex];
      if (option.isFiltered()) {
        continue;
      }
      if ((y > -optionHeight && render) || (isListOptionOpen && hoverOption == option)) {
        renderOption(g,option,y);
      }
      y+=optionHeight;
      maxScrollOffset+=optionHeight;
      lineHeight+=optionHeight;
      if (y > height) {
        render=false;
        groupIndex=groups.length;
        maxScrollOffset+=(section.getOptions().length - optionIndex - 1) * optionHeight;
      }
    }
    g.setColor(COL_GREY);
    g.fillRect(paddingLeft,lineStartY,LINEWIDTH,lineHeight);
  }
  for (groupIndex=lastNonSkippedSectionIndex + 1; groupIndex < groups.length; groupIndex++) {
    maxScrollOffset+=Fonts.LARGE.getLineHeight() * 1.5f;
    if (groups[groupIndex].getOptions() != null) {
      maxScrollOffset+=groups[groupIndex].getOptions().length * optionHeight;
    }
  }
  maxScrollOffset-=height * 2 / 3;
  if (maxScrollOffset < 0) {
    maxScrollOffset=0;
  }
  if (scrolling.getPosition() > maxScrollOffset) {
    scrolling.setPosition(maxScrollOffset);
  }
  scrolling.setMinMax(0,maxScrollOffset);
}

Fixed version (ground truth):
/** 
 * Renders all options.
 * @param g the graphics context
 */
private void renderOptions(Graphics g){
  int y=(int)(-scrolling.getPosition() + optionStartY);
  maxScrollOffset=optionStartY;
  boolean render=true;
  int groupIndex=0;
  for (; groupIndex < groups.length && render; groupIndex++) {
    OptionGroup section=groups[groupIndex];
    if (section.isFiltered()) {
      continue;
    }
    int lineStartY=(int)(y + Fonts.LARGE.getLineHeight() * 0.6f);
    if (section.getOptions() == null) {
      Utils.drawRightAligned(Fonts.XLARGE,width,-paddingRight,(int)(y + Fonts.XLARGE.getLineHeight() * 0.3f),section.getName(),COL_CYAN);
    }
 else {
      Fonts.MEDIUMBOLD.drawString(paddingTextLeft,lineStartY,section.getName(),COL_WHITE);
    }
    y+=Fonts.LARGE.getLineHeight() * 1.5f;
    maxScrollOffset+=Fonts.LARGE.getLineHeight() * 1.5f;
    if (section.getOptions() == null) {
      continue;
    }
    int lineHeight=(int)(Fonts.LARGE.getLineHeight() * 0.9f);
    for (int optionIndex=0; optionIndex < section.getOptions().length; optionIndex++) {
      GameOption option=section.getOptions()[optionIndex];
      if (option.isFiltered()) {
        continue;
      }
      if (y > -optionHeight || (isListOptionOpen && hoverOption == option)) {
        renderOption(g,option,y);
      }
      y+=optionHeight;
      maxScrollOffset+=optionHeight;
      lineHeight+=optionHeight;
      if (y > height) {
        render=false;
        maxScrollOffset+=(section.getOptions().length - optionIndex - 1) * optionHeight;
        break;
      }
    }
    g.setColor(COL_GREY);
    g.fillRect(paddingLeft,lineStartY,LINEWIDTH,lineHeight);
  }
  for (; groupIndex < groups.length; groupIndex++) {
    maxScrollOffset+=Fonts.LARGE.getLineHeight() * 1.5f;
    if (groups[groupIndex].getOptions() != null) {
      maxScrollOffset+=groups[groupIndex].getOptions().length * optionHeight;
    }
  }
  maxScrollOffset-=height * 2 / 3;
  if (maxScrollOffset < 0) {
    maxScrollOffset=0;
  }
  if (scrolling.getPosition() > maxScrollOffset) {
    scrolling.setPosition(maxScrollOffset);
  }
  scrolling.setMinMax(0,maxScrollOffset);
}