Program: 14831
Project: 14831
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;
  }
  Bundle extras=getIntent().getExtras();
  if (extras != null && extras.getBoolean(NotificationsActivity.FROM_NOTIFICATION_EXTRA)) {
    startNotificationsActivity(extras);
    return;
  }
  if (WordPress.shouldRestoreSelectedActivity && WordPress.getCurrentBlog() != null && !(this instanceof PagesActivity)) {
    new ApiHelper.RefreshBlogContentTask(this,WordPress.getCurrentBlog(),new ApiHelper.GenericCallback(){
      @Override public void onSuccess(){
        if (!isFinishing())         updateMenuDrawer();
      }
      @Override public void onFailure(      ApiHelper.ErrorType errorType,      String errorMessage,      Throwable throwable){
        if (!isFinishing())         ToastUtils.showToastOrAuthAlert(PostsActivity.this,errorMessage,getString(R.string.error_generic));
      }
    }
).execute(false);
    WordPress.shouldRestoreSelectedActivity=false;
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
    int lastActivitySelection=settings.getInt(LAST_ACTIVITY_PREFERENCE,-1);
    if (lastActivitySelection > MenuDrawerItem.NO_ITEM_ID && lastActivitySelection != WPActionBarActivity.DASHBOARD_ACTIVITY) {
      Iterator<MenuDrawerItem> itemIterator=mMenuItems.iterator();
      while (itemIterator.hasNext()) {
        MenuDrawerItem item=itemIterator.next();
        if (item.hasItemId() && item.getItemId() == lastActivitySelection && !item.isSelected() && item.isVisible()) {
          mFirstLaunch=true;
          item.selectItem();
          finish();
          return;
        }
      }
    }
  }
  createMenuDrawer(R.layout.posts);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayShowTitleEnabled(true);
  FragmentManager fm=getSupportFragmentManager();
  fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
  mPostList=(PostsListFragment)fm.findFragmentById(R.id.postList);
  if (extras != null) {
    mIsPage=extras.getBoolean(EXTRA_VIEW_PAGES);
    showErrorDialogIfNeeded(extras);
  }
  if (mIsPage)   setTitle(getString(R.string.pages));
 else   setTitle(getString(R.string.posts));
  WordPress.currentPost=null;
  if (savedInstanceState != null)   popPostDetail();
  WPMobileStatsUtil.trackEventForWPCom(statEventForViewOpening());
}

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;
  }
  Bundle extras=getIntent().getExtras();
  if (extras != null && extras.getBoolean(NotificationsActivity.FROM_NOTIFICATION_EXTRA)) {
    startNotificationsActivity(extras);
    return;
  }
  if (WordPress.shouldRestoreSelectedActivity && WordPress.getCurrentBlog() != null && !(this instanceof PagesActivity)) {
    new ApiHelper.RefreshBlogContentTask(this,WordPress.getCurrentBlog(),new ApiHelper.GenericCallback(){
      @Override public void onSuccess(){
        if (!isFinishing())         updateMenuDrawer();
      }
      @Override public void onFailure(      ApiHelper.ErrorType errorType,      String errorMessage,      Throwable throwable){
        if (!isFinishing())         ToastUtils.showToastOrAuthAlert(PostsActivity.this,errorMessage,getString(R.string.error_generic));
      }
    }
).execute(false);
    WordPress.shouldRestoreSelectedActivity=false;
    SharedPreferences settings=PreferenceManager.getDefaultSharedPreferences(this);
    int lastActivitySelection=settings.getInt(LAST_ACTIVITY_PREFERENCE,-1);
    if (lastActivitySelection > MenuDrawerItem.NO_ITEM_ID && lastActivitySelection != WPActionBarActivity.DASHBOARD_ACTIVITY) {
      Iterator<MenuDrawerItem> itemIterator=mMenuItems.iterator();
      while (itemIterator.hasNext()) {
        MenuDrawerItem item=itemIterator.next();
        if (item.hasItemId() && item.getItemId() == lastActivitySelection && !item.isSelected() && item.isVisible()) {
          mFirstLaunch=true;
          item.selectItem();
          finish();
          return;
        }
      }
    }
  }
  createMenuDrawer(R.layout.posts);
  ActionBar actionBar=getSupportActionBar();
  actionBar.setDisplayShowTitleEnabled(true);
  FragmentManager fm=getSupportFragmentManager();
  fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
  mPostList=(PostsListFragment)fm.findFragmentById(R.id.postList);
  if (extras != null) {
    mIsPage=extras.getBoolean(EXTRA_VIEW_PAGES);
    showErrorDialogIfNeeded(extras);
  }
  if (mIsPage)   setTitle(getString(R.string.pages));
 else   setTitle(getString(R.string.posts));
  WordPress.currentPost=null;
  if (savedInstanceState != null)   popPostDetail();
  attemptToSelectPost();
  WPMobileStatsUtil.trackEventForWPCom(statEventForViewOpening());
}