Program: 117662
Project: 117662
Buggy source:
@Override public synchronized void deleteTab(int id){
  mTabLayout.clearDisappearingChildren();
  int position=mIdList.indexOf(id);
  if (position >= mWebViewList.size()) {
    return;
  }
  mTabScrollView.smoothScrollTo(mCurrentView.getTitleView().getLeft(),0);
  int current=mIdList.indexOf(mCurrentView.getId());
  if (current == -1) {
    return;
  }
  LightningView reference=mWebViewList.get(position);
  if (reference == null) {
    return;
  }
  final boolean isShown=reference.isShown();
  if (current > position) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position - 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
  }
 else   if (mWebViewList.size() > position + 1) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position + 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
  }
 else   if (mWebViewList.size() > 1) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position - 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
  }
 else {
    if (mCurrentView.getUrl().startsWith(Constants.FILE) || mCurrentView.getUrl().equals(mHomepage)) {
      moveTaskToBack(true);
    }
 else {
      mWebViewList.remove(position);
      mIdList.remove(position);
      if (mPreferences.getBoolean(PreferenceConstants.CLEAR_CACHE_EXIT,false) && mCurrentView != null) {
        mCurrentView.clearCache(true);
      }
      if (reference != null) {
        reference.pauseTimers();
        reference.onDestroy();
      }
      mCurrentView=null;
      finish();
    }
  }
  Log.i("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public synchronized void deleteTab(int id){
  if (viewIsAnimating) {
    return;
  }
  mTabLayout.clearDisappearingChildren();
  int position=mIdList.indexOf(id);
  if (position >= mWebViewList.size()) {
    return;
  }
  if (position == -1) {
    return;
  }
  int current=mIdList.indexOf(mCurrentView.getId());
  if (current == -1) {
    return;
  }
  LightningView reference=mWebViewList.get(position);
  if (reference == null) {
    return;
  }
  mTabScrollView.smoothScrollTo(mCurrentView.getTitleView().getLeft(),0);
  final boolean isShown=reference.isShown();
  if (current > position) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position - 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
    reference.onDestroy();
    mWebViewList.remove(position);
    mIdList.remove(position);
  }
 else   if (mWebViewList.size() > position + 1) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position + 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
    reference.onDestroy();
    mWebViewList.remove(position);
    mIdList.remove(position);
  }
 else   if (mWebViewList.size() > 1) {
    if (reference.isShown()) {
      showTab(mWebViewList.get(position - 1));
    }
    animateTabRemoval(mWebViewList.get(position).getTitleView(),position,reference,isShown);
    reference.onDestroy();
    mWebViewList.remove(position);
    mIdList.remove(position);
  }
 else {
    if (mCurrentView.getUrl().startsWith(Constants.FILE) || mCurrentView.getUrl().equals(mHomepage)) {
      moveTaskToBack(true);
    }
 else {
      mWebViewList.remove(position);
      mIdList.remove(position);
      if (mPreferences.getBoolean(PreferenceConstants.CLEAR_CACHE_EXIT,false) && mCurrentView != null) {
        mCurrentView.clearCache(true);
      }
      if (reference != null) {
        reference.pauseTimers();
        reference.onDestroy();
      }
      mCurrentView=null;
      finish();
    }
  }
  Log.i("String_Node_Str","String_Node_Str");
}