Program: 164493
Project: 164493
Buggy source:
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  if (savedInstanceState == null) {
    mCommentSort=CommentSort.getSortFromString(app.getPreferences().getString(KEY_SORT,null));
    mLoadComments=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(KEY_LOAD_COMMENTS,true);
    if (!TextUtils.isEmpty(mGalleryId)) {
      boolean isAlbumLink=getIntent().getBooleanExtra(KEY_VIEW_FOR_ALBUM,false);
      fetchItemDetails(mGalleryId,isAlbumLink);
      mMultiView.setViewState(MultiStateView.ViewState.LOADING);
    }
 else {
      mViewPager.setAdapter(mPagerAdapter);
      if (mCurrentPosition == 0) {
        fetchComments();
      }
 else {
        mViewPager.setCurrentItem(mCurrentPosition);
      }
    }
  }
 else {
    mCommentSort=CommentSort.getSortFromString(savedInstanceState.getString(KEY_SORT,CommentSort.NEW.getSort()));
    mLoadComments=savedInstanceState.getBoolean(KEY_LOAD_COMMENTS,true);
    mIsResuming=true;
    mCurrentPosition=savedInstanceState.getInt(KEY_POSITION,0);
    ArrayList<ImgurBaseObject> objects=savedInstanceState.getParcelableArrayList(KEY_OBJECTS);
    mPagerAdapter=new BrowsingAdapter(getApplicationContext(),getFragmentManager(),objects);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setCurrentItem(mCurrentPosition);
    if (mSideGalleryFragment != null) {
      mSideGalleryFragment.addGalleryItems(objects);
    }
    List<ImgurComment> comments=savedInstanceState.getParcelableArrayList(KEY_COMMENT);
    if (comments != null) {
      mCommentAdapter=new CommentAdapter(this,comments,this);
      mCommentList.setAdapter(mCommentAdapter);
    }
    if (mLoadComments) {
      mMultiView.setViewState(MultiStateView.VIEW_STATE_CONTENT);
    }
 else {
      mMultiView.setErrorText(R.id.errorMessage,R.string.comments_off);
      mMultiView.setViewState(MultiStateView.VIEW_STATE_ERROR);
    }
    if (savedInstanceState.getBoolean(KEY_PANEL_EXPANDED,false))     getSupportActionBar().hide();
  }
}

Fixed version (ground truth):
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  if (savedInstanceState == null) {
    mCommentSort=CommentSort.getSortFromString(app.getPreferences().getString(KEY_SORT,null));
    mLoadComments=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(KEY_LOAD_COMMENTS,true);
    if (!TextUtils.isEmpty(mGalleryId)) {
      boolean isAlbumLink=getIntent().getBooleanExtra(KEY_VIEW_FOR_ALBUM,false);
      fetchItemDetails(mGalleryId,isAlbumLink);
      mMultiView.setViewState(MultiStateView.VIEW_STATE_LOADING);
    }
 else {
      mViewPager.setAdapter(mPagerAdapter);
      if (mCurrentPosition == 0) {
        fetchComments();
      }
 else {
        mViewPager.setCurrentItem(mCurrentPosition);
      }
    }
  }
 else {
    mCommentSort=CommentSort.getSortFromString(savedInstanceState.getString(KEY_SORT,CommentSort.NEW.getSort()));
    mLoadComments=savedInstanceState.getBoolean(KEY_LOAD_COMMENTS,true);
    mIsResuming=true;
    mCurrentPosition=savedInstanceState.getInt(KEY_POSITION,0);
    ArrayList<ImgurBaseObject> objects=savedInstanceState.getParcelableArrayList(KEY_OBJECTS);
    mPagerAdapter=new BrowsingAdapter(getApplicationContext(),getFragmentManager(),objects);
    mViewPager.setAdapter(mPagerAdapter);
    mViewPager.setCurrentItem(mCurrentPosition);
    if (mSideGalleryFragment != null) {
      mSideGalleryFragment.addGalleryItems(objects);
    }
    List<ImgurComment> comments=savedInstanceState.getParcelableArrayList(KEY_COMMENT);
    if (comments != null) {
      mCommentAdapter=new CommentAdapter(this,comments,this);
      mCommentList.setAdapter(mCommentAdapter);
    }
    if (mLoadComments) {
      mMultiView.setViewState(MultiStateView.VIEW_STATE_CONTENT);
    }
 else {
      mMultiView.setErrorText(R.id.errorMessage,R.string.comments_off);
      mMultiView.setViewState(MultiStateView.VIEW_STATE_ERROR);
    }
    if (savedInstanceState.getBoolean(KEY_PANEL_EXPANDED,false))     getSupportActionBar().hide();
  }
}