Program: 15016
Project: 15016
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (WordPress.wpDB == null) {
    Toast.makeText(this,R.string.fatal_db_error,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  setTitle(R.string.media_gallery_edit);
  setContentView(R.layout.media_gallery_activity);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayShowTitleEnabled(true);
  FragmentManager fm=getSupportFragmentManager();
  mMediaGallery=(MediaGallery)getIntent().getSerializableExtra(PARAMS_MEDIA_GALLERY);
  if (mMediaGallery == null)   mMediaGallery=new MediaGallery();
  mMediaGalleryEditFragment=(MediaGalleryEditFragment)fm.findFragmentById(R.id.mediaGalleryEditFragment);
  mMediaGalleryEditFragment.setMediaIds(mMediaGallery.getIds());
  mMediaGallerySettingsFragment=(MediaGallerySettingsFragment)fm.findFragmentById(R.id.mediaGallerySettingsFragment);
  mMediaGallerySettingsFragment.setRandom(mMediaGallery.isRandom());
  mMediaGallerySettingsFragment.setNumColumns(mMediaGallery.getNumColumns());
  mMediaGallerySettingsFragment.setType(mMediaGallery.getType());
  mSlidingPanelLayout=(SlidingUpPanelLayout)findViewById(R.id.media_gallery_root);
  if (mSlidingPanelLayout != null) {
    mSlidingPanelLayout.setDragView(mMediaGallerySettingsFragment.getDragView());
    mSlidingPanelLayout.setPanelHeight((int)Utils.dpToPx(48));
    mSlidingPanelLayout.setPanelSlideListener(new PanelSlideListener(){
      @Override public void onPanelSlide(      View panel,      float slideOffset){
      }
      @Override public void onPanelExpanded(      View panel){
        mMediaGallerySettingsFragment.onPanelExpanded();
        mIsPanelCollapsed=false;
      }
      @Override public void onPanelCollapsed(      View panel){
        mMediaGallerySettingsFragment.onPanelCollapsed();
        mIsPanelCollapsed=true;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (WordPress.wpDB == null) {
    Toast.makeText(this,R.string.fatal_db_error,Toast.LENGTH_LONG).show();
    finish();
    return;
  }
  setTitle(R.string.media_gallery_edit);
  setContentView(R.layout.media_gallery_activity);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayShowTitleEnabled(true);
  FragmentManager fm=getSupportFragmentManager();
  mMediaGallery=(MediaGallery)getIntent().getSerializableExtra(PARAMS_MEDIA_GALLERY);
  if (mMediaGallery == null)   mMediaGallery=new MediaGallery();
  mMediaGalleryEditFragment=(MediaGalleryEditFragment)fm.findFragmentById(R.id.mediaGalleryEditFragment);
  mMediaGalleryEditFragment.setMediaIds(mMediaGallery.getIds());
  mMediaGallerySettingsFragment=(MediaGallerySettingsFragment)fm.findFragmentById(R.id.mediaGallerySettingsFragment);
  if (savedInstanceState == null) {
    mMediaGallerySettingsFragment.setRandom(mMediaGallery.isRandom());
    mMediaGallerySettingsFragment.setNumColumns(mMediaGallery.getNumColumns());
    mMediaGallerySettingsFragment.setType(mMediaGallery.getType());
  }
  mSlidingPanelLayout=(SlidingUpPanelLayout)findViewById(R.id.media_gallery_root);
  if (mSlidingPanelLayout != null) {
    mSlidingPanelLayout.setDragView(mMediaGallerySettingsFragment.getDragView());
    mSlidingPanelLayout.setPanelHeight((int)Utils.dpToPx(48));
    mSlidingPanelLayout.setPanelSlideListener(new PanelSlideListener(){
      @Override public void onPanelSlide(      View panel,      float slideOffset){
      }
      @Override public void onPanelExpanded(      View panel){
        mMediaGallerySettingsFragment.onPanelExpanded();
        mIsPanelCollapsed=false;
      }
      @Override public void onPanelCollapsed(      View panel){
        mMediaGallerySettingsFragment.onPanelCollapsed();
        mIsPanelCollapsed=true;
      }
    }
);
  }
}