Program: 14965
Project: 14965
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;
  }
  showErrorDialogIfNeeded(extras);
  if (WordPress.shouldRestoreSelectedActivity && WordPress.getCurrentBlog() != null && !(this instanceof PagesActivity)) {
    new ApiHelper.RefreshBlogContentTask(this,WordPress.getCurrentBlog(),new ApiHelper.RefreshBlogContentTask.Callback(){
      @Override public void onSuccess(){
        if (!isFinishing())         updateMenuDrawer();
      }
      @Override public void onFailure(){
      }
    }
).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);
  postList=(PostsListFragment)fm.findFragmentById(R.id.postList);
  postList.setListShown(true);
  if (extras != null) {
    isPage=extras.getBoolean("String_Node_Str");
    showErrorDialogIfNeeded(extras);
  }
  if (isPage)   setTitle(getString(R.string.pages));
 else   setTitle(getString(R.string.posts));
  WordPress.currentPost=null;
  WordPress.setOnPostUploadedListener(new WordPress.OnPostUploadedListener(){
    @Override public void OnPostUploaded(){
      if (isFinishing())       return;
      checkForLocalChanges(false);
    }
  }
);
  if (savedInstanceState != null)   popPostDetail();
}

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.RefreshBlogContentTask.Callback(){
      @Override public void onSuccess(){
        if (!isFinishing())         updateMenuDrawer();
      }
      @Override public void onFailure(){
      }
    }
).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);
  postList=(PostsListFragment)fm.findFragmentById(R.id.postList);
  postList.setListShown(true);
  if (extras != null) {
    isPage=extras.getBoolean("String_Node_Str");
    showErrorDialogIfNeeded(extras);
  }
  if (isPage)   setTitle(getString(R.string.pages));
 else   setTitle(getString(R.string.posts));
  WordPress.currentPost=null;
  WordPress.setOnPostUploadedListener(new WordPress.OnPostUploadedListener(){
    @Override public void OnPostUploaded(){
      if (isFinishing())       return;
      checkForLocalChanges(false);
    }
  }
);
  if (savedInstanceState != null)   popPostDetail();
}