Program: 178145
Project: 178145
Buggy source:
public InvTweaksHandlerSorting(Minecraft mc,InvTweaksConfig config,InvTweaksContainerSection section,int algorithm,int rowSize) throws Exception {
  super(mc);
  if (DEFAULT_LOCK_PRIORITIES == null) {
    DEFAULT_LOCK_PRIORITIES=new int[MAX_CONTAINER_SIZE];
    for (int i=0; i < MAX_CONTAINER_SIZE; i++) {
      DEFAULT_LOCK_PRIORITIES[i]=0;
    }
  }
  if (DEFAULT_FROZEN_SLOTS == null) {
    DEFAULT_FROZEN_SLOTS=new boolean[MAX_CONTAINER_SIZE];
    for (int i=0; i < MAX_CONTAINER_SIZE; i++) {
      DEFAULT_FROZEN_SLOTS[i]=false;
    }
  }
  this.containerMgr=new InvTweaksContainerSectionManager(mc,section);
  this.size=containerMgr.getSize();
  this.sortArmorParts=config.getProperty(InvTweaksConfig.PROP_ENABLE_AUTO_EQUIP_ARMOR).equals(InvTweaksConfig.VALUE_TRUE);
  this.rules=config.getRules();
  this.tree=config.getTree();
  if (section == InvTweaksContainerSection.INVENTORY) {
    this.lockPriorities=config.getLockPriorities();
    this.frozenSlots=config.getFrozenSlots();
    this.algorithm=ALGORITHM_INVENTORY;
  }
 else {
    this.lockPriorities=DEFAULT_LOCK_PRIORITIES;
    this.frozenSlots=DEFAULT_FROZEN_SLOTS;
    this.algorithm=algorithm;
    if (algorithm != ALGORITHM_DEFAULT) {
      computeLineSortingRules(rowSize,algorithm == ALGORITHM_HORIZONTAL);
    }
  }
  this.rulePriority=new int[size];
  this.keywordOrder=new int[size];
  for (int i=0; i < size; i++) {
    this.rulePriority[i]=-1;
    rj stack=containerMgr.getItemStack(i);
    if (stack != null) {
      this.keywordOrder[i]=getItemOrder(stack);
    }
 else {
      this.keywordOrder[i]=-1;
    }
  }
}

Fixed version (ground truth):
public InvTweaksHandlerSorting(Minecraft mc,InvTweaksConfig config,InvTweaksContainerSection section,int algorithm,int rowSize) throws Exception {
  super(mc);
  if (DEFAULT_LOCK_PRIORITIES == null) {
    DEFAULT_LOCK_PRIORITIES=new int[MAX_CONTAINER_SIZE];
    for (int i=0; i < MAX_CONTAINER_SIZE; i++) {
      DEFAULT_LOCK_PRIORITIES[i]=0;
    }
  }
  if (DEFAULT_FROZEN_SLOTS == null) {
    DEFAULT_FROZEN_SLOTS=new boolean[MAX_CONTAINER_SIZE];
    for (int i=0; i < MAX_CONTAINER_SIZE; i++) {
      DEFAULT_FROZEN_SLOTS[i]=false;
    }
  }
  this.containerMgr=new InvTweaksContainerSectionManager(mc,section);
  this.size=containerMgr.getSize();
  this.sortArmorParts=config.getProperty(InvTweaksConfig.PROP_ENABLE_AUTO_EQUIP_ARMOR).equals(InvTweaksConfig.VALUE_TRUE) && !isGuiInventoryCreative(getCurrentScreen());
  this.rules=config.getRules();
  this.tree=config.getTree();
  if (section == InvTweaksContainerSection.INVENTORY) {
    this.lockPriorities=config.getLockPriorities();
    this.frozenSlots=config.getFrozenSlots();
    this.algorithm=ALGORITHM_INVENTORY;
  }
 else {
    this.lockPriorities=DEFAULT_LOCK_PRIORITIES;
    this.frozenSlots=DEFAULT_FROZEN_SLOTS;
    this.algorithm=algorithm;
    if (algorithm != ALGORITHM_DEFAULT) {
      computeLineSortingRules(rowSize,algorithm == ALGORITHM_HORIZONTAL);
    }
  }
  this.rulePriority=new int[size];
  this.keywordOrder=new int[size];
  for (int i=0; i < size; i++) {
    this.rulePriority[i]=-1;
    rj stack=containerMgr.getItemStack(i);
    if (stack != null) {
      this.keywordOrder[i]=getItemOrder(stack);
    }
 else {
      this.keywordOrder[i]=-1;
    }
  }
}