Program: 56496
Project: 56496
Buggy source:
@Override protected void action(){
  if (isJobless())   return;
switch (currentJob.getType()) {
case GO_TO:
    gotoAction();
  break;
case IS_PRODUCTIVE:
if (isProductive()) {
  jobFinished();
}
 else {
  jobFailed();
}
break;
case WAIT:
waitSeconds();
break;
case WALK:
super.forceGoInDirection(currentJob.getDirection());
jobFinished();
break;
case SHOW:
ShortPoint2D pos=getCurrentJobPos();
super.setPosition(pos);
super.setVisible(true);
jobFinished();
break;
case HIDE:
super.setVisible(false);
jobFinished();
break;
case SET_MATERIAL:
super.setMaterial(currentJob.getMaterial());
jobFinished();
break;
case TAKE:
takeAction();
break;
case REMOTETAKE:
if (this.building.popMaterial(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case DROP:
dropAction(currentJob.getMaterial());
break;
case DROP_POPPED:
dropAction(poppedMaterial);
break;
case PRE_SEARCH:
preSearchPathAction(true);
break;
case PRE_SEARCH_IN_AREA:
preSearchPathAction(false);
break;
case FOLLOW_SEARCHED:
followPreSearchedAction();
break;
case LOOK_AT_SEARCHED:
lookAtSearched();
break;
case LOOK_AT:
super.lookInDirection(currentJob.getDirection());
jobFinished();
break;
case EXECUTE:
executeAction();
break;
case PLAY_ACTION1:
super.playAction(EAction.ACTION1,currentJob.getTime());
jobFinished();
break;
case PLAY_ACTION2:
super.playAction(EAction.ACTION2,currentJob.getTime());
jobFinished();
break;
case AVAILABLE:
if (super.getStrategyGrid().canPop(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case NOT_FULL:
if (super.getStrategyGrid().canPushMaterial(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case SMOKE_ON:
case SMOKE_OFF:
{
super.getStrategyGrid().placeSmoke(getCurrentJobPos(),currentJob.getType() == EBuildingJobType.SMOKE_ON);
jobFinished();
break;
}
case START_WORKING:
case STOP_WORKING:
if (building instanceof MillBuilding) {
((MillBuilding)building).setRotating(currentJob.getType() == EBuildingJobType.START_WORKING);
}
jobFinished();
break;
case PIG_IS_ADULT:
if (super.getStrategyGrid().isPigAdult(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_IS_THERE:
if (super.getStrategyGrid().hasPigAt(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_PLACE:
case PIG_REMOVE:
placeOrRemovePigAction();
break;
case POP_TOOL:
popToolRequestAction();
break;
}
}

Fixed version (ground truth):
@Override protected void action(){
  if (isJobless())   return;
  if (!building.isNotDestroyed()) {
    buildingDestroyed();
    return;
  }
switch (currentJob.getType()) {
case GO_TO:
    gotoAction();
  break;
case IS_PRODUCTIVE:
if (isProductive()) {
  jobFinished();
}
 else {
  jobFailed();
}
break;
case WAIT:
waitSeconds();
break;
case WALK:
super.forceGoInDirection(currentJob.getDirection());
jobFinished();
break;
case SHOW:
ShortPoint2D pos=getCurrentJobPos();
super.setPosition(pos);
super.setVisible(true);
jobFinished();
break;
case HIDE:
super.setVisible(false);
jobFinished();
break;
case SET_MATERIAL:
super.setMaterial(currentJob.getMaterial());
jobFinished();
break;
case TAKE:
takeAction();
break;
case REMOTETAKE:
if (this.building.popMaterial(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case DROP:
dropAction(currentJob.getMaterial());
break;
case DROP_POPPED:
boolean oldDone=done;
dropAction(poppedMaterial);
if (oldDone) poppedMaterial=null;
break;
case PRE_SEARCH:
preSearchPathAction(true);
break;
case PRE_SEARCH_IN_AREA:
preSearchPathAction(false);
break;
case FOLLOW_SEARCHED:
followPreSearchedAction();
break;
case LOOK_AT_SEARCHED:
lookAtSearched();
break;
case LOOK_AT:
super.lookInDirection(currentJob.getDirection());
jobFinished();
break;
case EXECUTE:
executeAction();
break;
case PLAY_ACTION1:
super.playAction(EAction.ACTION1,currentJob.getTime());
jobFinished();
break;
case PLAY_ACTION2:
super.playAction(EAction.ACTION2,currentJob.getTime());
jobFinished();
break;
case AVAILABLE:
if (super.getStrategyGrid().canPop(getCurrentJobPos(),currentJob.getMaterial())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case NOT_FULL:
if (super.getStrategyGrid().canPushMaterial(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case SMOKE_ON:
case SMOKE_OFF:
{
super.getStrategyGrid().placeSmoke(getCurrentJobPos(),currentJob.getType() == EBuildingJobType.SMOKE_ON);
jobFinished();
break;
}
case START_WORKING:
case STOP_WORKING:
if (building instanceof MillBuilding) {
((MillBuilding)building).setRotating(currentJob.getType() == EBuildingJobType.START_WORKING);
}
jobFinished();
break;
case PIG_IS_ADULT:
if (super.getStrategyGrid().isPigAdult(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_IS_THERE:
if (super.getStrategyGrid().hasPigAt(getCurrentJobPos())) {
jobFinished();
}
 else {
jobFailed();
}
break;
case PIG_PLACE:
case PIG_REMOVE:
placeOrRemovePigAction();
break;
case POP_TOOL:
popToolRequestAction();
break;
}
}