Program: 64775
Project: 64775
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  Core core=new Core(getActivity().getApplicationContext());
  BaseFragmentActivity activity=(BaseFragmentActivity)getActivity();
  if (activity != null)   activity.getSupportActionBar().setSubtitle(null);
  if (!(core.isTablet() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
    activity.getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE| ActionBar.DISPLAY_SHOW_CUSTOM);
    LayoutInflater inflater=(LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View actionBarButtons=inflater.inflate(R.layout.actionbar_button_cancel_done,new LinearLayout(getActivity()),false);
    View cancelActionView=actionBarButtons.findViewById(R.id.action_cancel);
    cancelActionView.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        onDoneClick();
      }
    }
);
    View doneActionView=actionBarButtons.findViewById(R.id.action_done);
    ImageView doneImageView=(ImageView)doneActionView.findViewById(R.id.image_done);
    doneImageView.setImageDrawable(getActivity().getResources().getDrawable(core.resolveIdAttribute(R.attr.ic_action_search)));
    TextView doneTextView=(TextView)doneActionView.findViewById(R.id.text_done);
    doneTextView.setText(R.string.search);
    doneActionView.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        onSearchClick();
      }
    }
);
    activity.getSupportActionBar().setCustomView(actionBarButtons);
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  Core core=new Core(getActivity());
  BaseFragmentActivity activity=(BaseFragmentActivity)getActivity();
  if (activity != null)   activity.getSupportActionBar().setSubtitle(null);
  if (!(core.isTablet() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
    activity.getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE| ActionBar.DISPLAY_SHOW_CUSTOM);
    LayoutInflater inflater=(LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View actionBarButtons=inflater.inflate(R.layout.actionbar_button_cancel_done,new LinearLayout(getActivity()),false);
    View cancelActionView=actionBarButtons.findViewById(R.id.action_cancel);
    cancelActionView.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        onDoneClick();
      }
    }
);
    View doneActionView=actionBarButtons.findViewById(R.id.action_done);
    ImageView doneImageView=(ImageView)doneActionView.findViewById(R.id.image_done);
    doneImageView.setImageDrawable(getActivity().getResources().getDrawable(core.resolveIdAttribute(R.attr.ic_action_search)));
    TextView doneTextView=(TextView)doneActionView.findViewById(R.id.text_done);
    doneTextView.setText(R.string.search);
    doneActionView.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        onSearchClick();
      }
    }
);
    activity.getSupportActionBar().setCustomView(actionBarButtons);
  }
}