Program: 164505
Project: 164505
Buggy source:
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  if (savedInstanceState == null) {
    mCommentSort=CommentSort.getSortFromString(app.getPreferences().getString(KEY_SORT,CommentSort.NEW.getSort()));
    mLoadComments=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(KEY_LOAD_COMMENTS,true);
    if (!TextUtils.isEmpty(mGalleryId)) {
      boolean isAlbumLink=getIntent().getBooleanExtra(KEY_VIEW_FOR_ALBUM,false);
      String url;
      ImgurBusEvent.EventType eventType;
      if (isAlbumLink) {
        url=String.format(Endpoints.ALBUM.getUrl(),mGalleryId);
        eventType=ImgurBusEvent.EventType.ALBUM_DETAILS;
      }
 else {
        url=String.format(Endpoints.GALLERY_ITEM_DETAILS.getUrl(),mGalleryId);
        eventType=ImgurBusEvent.EventType.GALLERY_ITEM_INFO;
      }
      mApiClient=new ApiClient(url,ApiClient.HttpRequest.GET);
      mApiClient.doWork(eventType,mGalleryId,null);
    }
 else {
      mViewPager.setAdapter(mPagerAdapter);
      if (mCurrentPosition == 0) {
        loadComments();
      }
 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(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);
      mCommentList.removeHeaderView(mCommentListHeader);
    }
    if (mLoadComments) {
      mMultiView.setViewState(MultiStateView.ViewState.CONTENT);
    }
 else {
      mMultiView.setErrorText(R.id.errorMessage,R.string.comments_off);
      mMultiView.setViewState(MultiStateView.ViewState.ERROR);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostCreate(Bundle savedInstanceState){
  super.onPostCreate(savedInstanceState);
  if (savedInstanceState == null) {
    mCommentSort=CommentSort.getSortFromString(app.getPreferences().getString(KEY_SORT,CommentSort.NEW.getSort()));
    mLoadComments=PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean(KEY_LOAD_COMMENTS,true);
    if (!TextUtils.isEmpty(mGalleryId)) {
      boolean isAlbumLink=getIntent().getBooleanExtra(KEY_VIEW_FOR_ALBUM,false);
      String url;
      ImgurBusEvent.EventType eventType;
      if (isAlbumLink) {
        url=String.format(Endpoints.ALBUM.getUrl(),mGalleryId);
        eventType=ImgurBusEvent.EventType.ALBUM_DETAILS;
      }
 else {
        url=String.format(Endpoints.GALLERY_ITEM_DETAILS.getUrl(),mGalleryId);
        eventType=ImgurBusEvent.EventType.GALLERY_ITEM_INFO;
      }
      mApiClient=new ApiClient(url,ApiClient.HttpRequest.GET);
      mApiClient.doWork(eventType,mGalleryId,null);
    }
 else {
      mViewPager.setAdapter(mPagerAdapter);
      if (mCurrentPosition == 0) {
        loadComments();
      }
 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(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);
      mCommentList.removeHeaderView(mCommentListHeader);
    }
    if (mLoadComments) {
      mMultiView.setViewState(MultiStateView.ViewState.CONTENT);
    }
 else {
      mMultiView.setErrorText(R.id.errorMessage,R.string.comments_off);
      mMultiView.setViewState(MultiStateView.ViewState.ERROR);
    }
    if (savedInstanceState.getBoolean(KEY_PANEL_EXPANDED,false))     getSupportActionBar().hide();
  }
}