Program: 171257
Project: 171257
Buggy source:
public static void equipClothing(GameCharacter character,boolean replaceUnsuitableClothing,boolean onlyAddCoreClothing){
  Colour primaryColour=ColourListPresets.ALL.getPresetColourList().get(Util.random.nextInt(ColourListPresets.ALL.getPresetColourList().size())), secondaryColour=ColourListPresets.ALL.getPresetColourList().get(Util.random.nextInt(ColourListPresets.ALL.getPresetColourList().size())), lingerieColour=ColourListPresets.LINGERIE.getPresetColourList().get(Util.random.nextInt(ColourListPresets.LINGERIE.getPresetColourList().size()));
  String clothingPattern="String_Node_Str";
  int patternIndex=(int)(Math.random() * Pattern.getAllPatterns().values().size());
  for (  Pattern pattern : Pattern.getAllPatterns().values())   if (--patternIndex < 0) {
    if (Math.random() >= 0.8f) {
      clothingPattern=pattern.getName();
    }
    break;
  }
  List<InventorySlot> inventorySlotsInPriorityOrder=new ArrayList<>();
  inventorySlotsInPriorityOrder.add(InventorySlot.TORSO_UNDER);
  for (  InventorySlot slot : InventorySlot.values()) {
    if (slot != InventorySlot.TORSO_UNDER) {
      inventorySlotsInPriorityOrder.add(slot);
    }
  }
  if ((character.isFeminine() && !character.hasFetish(Fetish.FETISH_CROSS_DRESSER)) || (!character.isFeminine() && character.hasFetish(Fetish.FETISH_CROSS_DRESSER))) {
    for (    InventorySlot slot : inventorySlotsInPriorityOrder) {
      if (replaceUnsuitableClothing) {
        if (character.getClothingInSlot(slot) != null) {
          if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.MASCULINE) {
            character.unequipClothingIntoVoid(character.getClothingInSlot(slot),true,character);
          }
        }
      }
      if ((!slot.isCoreClothing() && onlyAddCoreClothing) || (slot == InventorySlot.LEG && character.getClothingInSlot(InventorySlot.TORSO_UNDER) != null && character.getClothingInSlot(InventorySlot.TORSO_UNDER).getClothingType().toString().contains("String_Node_Str"))) {
      }
 else {
        if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
          if (!ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
            List<AbstractClothingType> clothingToUse=ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot);
            if (character.getHistory() == History.PROSTITUTE) {
              clothingToUse=suitableFeminineClothing.get(History.PROSTITUTE);
            }
            AbstractClothingType ct=getClothingTypeForSlot(character,slot,clothingToUse);
            if (ct != null) {
              clothingToUse.remove(ClothingType.PENIS_CONDOM);
              AbstractClothing clothingToAdd=AbstractClothingType.generateClothing(ct,(slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))),false);
              clothingToAdd.setPattern(clothingPattern);
              character.equipClothingFromNowhere(clothingToAdd,true,character);
            }
          }
        }
      }
    }
  }
 else {
    for (    InventorySlot slot : inventorySlotsInPriorityOrder) {
      if (replaceUnsuitableClothing) {
        if (character.getClothingInSlot(slot) != null) {
          if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.FEMININE) {
            character.unequipClothingIntoVoid(character.getClothingInSlot(slot),true,character);
          }
        }
      }
      if ((!slot.isCoreClothing() && onlyAddCoreClothing) || (slot == InventorySlot.LEG && character.getClothingInSlot(InventorySlot.TORSO_UNDER) != null && character.getClothingInSlot(InventorySlot.TORSO_UNDER).getClothingType().toString().contains("String_Node_Str"))) {
      }
 else {
        if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
          if (!ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
            List<AbstractClothingType> clothingToUse=ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot);
            clothingToUse.remove(ClothingType.PENIS_CONDOM);
            AbstractClothingType ct=getClothingTypeForSlot(character,slot,clothingToUse);
            if (ct != null) {
              AbstractClothing clothingToAdd=AbstractClothingType.generateClothing(ct,(slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))),false);
              clothingToAdd.setPattern(clothingPattern);
              character.equipClothingFromNowhere(clothingToAdd,true,character);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public static void equipClothing(GameCharacter character,boolean replaceUnsuitableClothing,boolean onlyAddCoreClothing){
  Colour primaryColour=ColourListPresets.ALL.getPresetColourList().get(Util.random.nextInt(ColourListPresets.ALL.getPresetColourList().size())), secondaryColour=ColourListPresets.ALL.getPresetColourList().get(Util.random.nextInt(ColourListPresets.ALL.getPresetColourList().size())), lingerieColour=ColourListPresets.LINGERIE.getPresetColourList().get(Util.random.nextInt(ColourListPresets.LINGERIE.getPresetColourList().size()));
  String clothingPattern="String_Node_Str";
  if (Math.random() >= 0.8f) {
    List<Pattern> possiblePatterns=new ArrayList<>(Pattern.getAllPatterns().values());
    clothingPattern=possiblePatterns.get(Util.random.nextInt(possiblePatterns.size())).getName();
  }
  List<InventorySlot> inventorySlotsInPriorityOrder=new ArrayList<>();
  inventorySlotsInPriorityOrder.add(InventorySlot.TORSO_UNDER);
  for (  InventorySlot slot : InventorySlot.values()) {
    if (slot != InventorySlot.TORSO_UNDER) {
      inventorySlotsInPriorityOrder.add(slot);
    }
  }
  if ((character.isFeminine() && !character.hasFetish(Fetish.FETISH_CROSS_DRESSER)) || (!character.isFeminine() && character.hasFetish(Fetish.FETISH_CROSS_DRESSER))) {
    for (    InventorySlot slot : inventorySlotsInPriorityOrder) {
      if (replaceUnsuitableClothing) {
        if (character.getClothingInSlot(slot) != null) {
          if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.MASCULINE) {
            character.unequipClothingIntoVoid(character.getClothingInSlot(slot),true,character);
          }
        }
      }
      if ((!slot.isCoreClothing() && onlyAddCoreClothing) || (slot == InventorySlot.LEG && character.getClothingInSlot(InventorySlot.TORSO_UNDER) != null && character.getClothingInSlot(InventorySlot.TORSO_UNDER).getClothingType().toString().contains("String_Node_Str"))) {
      }
 else {
        if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
          if (!ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
            List<AbstractClothingType> clothingToUse=ClothingType.getCommonClothingMapFemaleIncludingAndrogynous().get(slot);
            if (character.getHistory() == History.PROSTITUTE) {
              clothingToUse=suitableFeminineClothing.get(History.PROSTITUTE);
            }
            AbstractClothingType ct=getClothingTypeForSlot(character,slot,clothingToUse);
            if (ct != null) {
              clothingToUse.remove(ClothingType.PENIS_CONDOM);
              AbstractClothing clothingToAdd=AbstractClothingType.generateClothing(ct,(slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))),false);
              clothingToAdd.setPattern(clothingPattern);
              character.equipClothingFromNowhere(clothingToAdd,true,character);
            }
          }
        }
      }
    }
  }
 else {
    for (    InventorySlot slot : inventorySlotsInPriorityOrder) {
      if (replaceUnsuitableClothing) {
        if (character.getClothingInSlot(slot) != null) {
          if (character.getClothingInSlot(slot).getClothingType().getFemininityRestriction() == Femininity.FEMININE) {
            character.unequipClothingIntoVoid(character.getClothingInSlot(slot),true,character);
          }
        }
      }
      if ((!slot.isCoreClothing() && onlyAddCoreClothing) || (slot == InventorySlot.LEG && character.getClothingInSlot(InventorySlot.TORSO_UNDER) != null && character.getClothingInSlot(InventorySlot.TORSO_UNDER).getClothingType().toString().contains("String_Node_Str"))) {
      }
 else {
        if ((slot.isCoreClothing() || Math.random() > 0.75f || slot.isJewellery()) && !character.isSlotIncompatible(slot) && character.getClothingInSlot(slot) == null) {
          if (!ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot).isEmpty() && (slot.slotBlockedByRace(character) != character.getRace())) {
            List<AbstractClothingType> clothingToUse=ClothingType.getCommonClothingMapMaleIncludingAndrogynous().get(slot);
            clothingToUse.remove(ClothingType.PENIS_CONDOM);
            AbstractClothingType ct=getClothingTypeForSlot(character,slot,clothingToUse);
            if (ct != null) {
              AbstractClothing clothingToAdd=AbstractClothingType.generateClothing(ct,(slot == InventorySlot.GROIN || slot == InventorySlot.CHEST || slot == InventorySlot.SOCK ? ct.getAvailablePrimaryColours().contains(lingerieColour) ? lingerieColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : (slot.isCoreClothing() ? ct.getAvailablePrimaryColours().contains(primaryColour) ? primaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())) : ct.getAvailablePrimaryColours().contains(secondaryColour) ? secondaryColour : ct.getAvailablePrimaryColours().get(Util.random.nextInt(ct.getAvailablePrimaryColours().size())))),false);
              clothingToAdd.setPattern(clothingPattern);
              character.equipClothingFromNowhere(clothingToAdd,true,character);
            }
          }
        }
      }
    }
  }
}