Program: 163966
Project: 163966
Buggy source:
WndGhostHero(final DriedRose rose){
  IconTitle titlebar=new IconTitle();
  titlebar.icon(new ItemSprite(rose));
  titlebar.label(Messages.get(this,"String_Node_Str"));
  titlebar.setRect(0,0,WIDTH,0);
  add(titlebar);
  RenderedTextMultiline message=PixelScene.renderMultiline(Messages.get(this,"String_Node_Str",rose.ghostStrength()),6);
  message.maxWidth(WIDTH);
  message.setPos(0,titlebar.bottom() + GAP);
  add(message);
  btnWeapon=new WndBlacksmith.ItemButton(){
    @Override protected void onClick(){
      if (rose.weapon != null) {
        if (rose.weapon.doPickUp(Dungeon.hero)) {
          item(new WndBag.Placeholder(ItemSpriteSheet.WEAPON_HOLDER));
        }
 else {
          Dungeon.level.drop(rose.weapon,Dungeon.hero.pos);
        }
        rose.weapon=null;
      }
 else {
        GameScene.selectItem(new WndBag.Listener(){
          @Override public void onSelect(          Item item){
            if (!(item instanceof MeleeWeapon || item instanceof Boomerang)) {
            }
 else             if (item.unique || item instanceof Boomerang) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (!item.isIdentified()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (item.cursed) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (((MeleeWeapon)item).STRReq() > rose.ghostStrength()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else {
              if (item.isEquipped(Dungeon.hero)) {
                ((MeleeWeapon)item).doUnequip(Dungeon.hero,false,false);
              }
 else {
                item.detach(Dungeon.hero.belongings.backpack);
              }
              rose.weapon=(MeleeWeapon)item;
              item(rose.weapon);
            }
          }
        }
,WndBag.Mode.WEAPON,Messages.get(WndGhostHero.class,"String_Node_Str"));
      }
    }
  }
;
  btnWeapon.setRect((WIDTH - BTN_GAP) / 2 - BTN_SIZE,message.top() + message.height() + GAP,BTN_SIZE,BTN_SIZE);
  if (rose.weapon != null) {
    btnWeapon.item(rose.weapon);
  }
 else {
    btnWeapon.item(new WndBag.Placeholder(ItemSpriteSheet.WEAPON_HOLDER));
  }
  add(btnWeapon);
  btnArmor=new WndBlacksmith.ItemButton(){
    @Override protected void onClick(){
      if (rose.armor != null) {
        if (rose.armor.doPickUp(Dungeon.hero)) {
          item(new WndBag.Placeholder(ItemSpriteSheet.ARMOR_HOLDER));
        }
 else {
          Dungeon.level.drop(rose.armor,Dungeon.hero.pos);
        }
        rose.armor=null;
      }
 else {
        GameScene.selectItem(new WndBag.Listener(){
          @Override public void onSelect(          Item item){
            if (!(item instanceof Armor)) {
            }
 else             if (item.unique || ((Armor)item).checkSeal() != null) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (!item.isIdentified()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (item.cursed) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (((Armor)item).STRReq() > rose.ghostStrength()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else {
              if (item.isEquipped(Dungeon.hero)) {
                ((Armor)item).doUnequip(Dungeon.hero,false,false);
              }
 else {
                item.detach(Dungeon.hero.belongings.backpack);
              }
              rose.armor=(Armor)item;
              item(rose.armor);
            }
          }
        }
,WndBag.Mode.ARMOR,Messages.get(WndGhostHero.class,"String_Node_Str"));
      }
    }
  }
;
  btnArmor.setRect(btnWeapon.right() + BTN_GAP,btnWeapon.top(),BTN_SIZE,BTN_SIZE);
  if (rose.armor != null) {
    btnArmor.item(rose.armor);
  }
 else {
    btnArmor.item(new WndBag.Placeholder(ItemSpriteSheet.ARMOR_HOLDER));
  }
  add(btnArmor);
  resize(WIDTH,(int)(btnArmor.bottom() + GAP));
}

Fixed version (ground truth):
WndGhostHero(final DriedRose rose){
  IconTitle titlebar=new IconTitle();
  titlebar.icon(new ItemSprite(rose));
  titlebar.label(Messages.get(this,"String_Node_Str"));
  titlebar.setRect(0,0,WIDTH,0);
  add(titlebar);
  RenderedTextMultiline message=PixelScene.renderMultiline(Messages.get(this,"String_Node_Str",rose.ghostStrength()),6);
  message.maxWidth(WIDTH);
  message.setPos(0,titlebar.bottom() + GAP);
  add(message);
  btnWeapon=new WndBlacksmith.ItemButton(){
    @Override protected void onClick(){
      if (rose.weapon != null) {
        item(new WndBag.Placeholder(ItemSpriteSheet.WEAPON_HOLDER));
        if (!rose.weapon.doPickUp(Dungeon.hero)) {
          Dungeon.level.drop(rose.weapon,Dungeon.hero.pos);
        }
        rose.weapon=null;
      }
 else {
        GameScene.selectItem(new WndBag.Listener(){
          @Override public void onSelect(          Item item){
            if (!(item instanceof MeleeWeapon || item instanceof Boomerang)) {
            }
 else             if (item.unique || item instanceof Boomerang) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (!item.isIdentified()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (item.cursed) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (((MeleeWeapon)item).STRReq() > rose.ghostStrength()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else {
              if (item.isEquipped(Dungeon.hero)) {
                ((MeleeWeapon)item).doUnequip(Dungeon.hero,false,false);
              }
 else {
                item.detach(Dungeon.hero.belongings.backpack);
              }
              rose.weapon=(MeleeWeapon)item;
              item(rose.weapon);
            }
          }
        }
,WndBag.Mode.WEAPON,Messages.get(WndGhostHero.class,"String_Node_Str"));
      }
    }
  }
;
  btnWeapon.setRect((WIDTH - BTN_GAP) / 2 - BTN_SIZE,message.top() + message.height() + GAP,BTN_SIZE,BTN_SIZE);
  if (rose.weapon != null) {
    btnWeapon.item(rose.weapon);
  }
 else {
    btnWeapon.item(new WndBag.Placeholder(ItemSpriteSheet.WEAPON_HOLDER));
  }
  add(btnWeapon);
  btnArmor=new WndBlacksmith.ItemButton(){
    @Override protected void onClick(){
      if (rose.armor != null) {
        item(new WndBag.Placeholder(ItemSpriteSheet.ARMOR_HOLDER));
        if (!rose.armor.doPickUp(Dungeon.hero)) {
          Dungeon.level.drop(rose.armor,Dungeon.hero.pos);
        }
        rose.armor=null;
      }
 else {
        GameScene.selectItem(new WndBag.Listener(){
          @Override public void onSelect(          Item item){
            if (!(item instanceof Armor)) {
            }
 else             if (item.unique || ((Armor)item).checkSeal() != null) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (!item.isIdentified()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (item.cursed) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else             if (((Armor)item).STRReq() > rose.ghostStrength()) {
              GLog.w(Messages.get(WndGhostHero.class,"String_Node_Str"));
              hide();
            }
 else {
              if (item.isEquipped(Dungeon.hero)) {
                ((Armor)item).doUnequip(Dungeon.hero,false,false);
              }
 else {
                item.detach(Dungeon.hero.belongings.backpack);
              }
              rose.armor=(Armor)item;
              item(rose.armor);
            }
          }
        }
,WndBag.Mode.ARMOR,Messages.get(WndGhostHero.class,"String_Node_Str"));
      }
    }
  }
;
  btnArmor.setRect(btnWeapon.right() + BTN_GAP,btnWeapon.top(),BTN_SIZE,BTN_SIZE);
  if (rose.armor != null) {
    btnArmor.item(rose.armor);
  }
 else {
    btnArmor.item(new WndBag.Placeholder(ItemSpriteSheet.ARMOR_HOLDER));
  }
  add(btnArmor);
  resize(WIDTH,(int)(btnArmor.bottom() + GAP));
}