Program: 162538
Project: 162538
Buggy source:
/** 
 * Loading adapter after getting a list of elements
 * @param bitmap   the list of objects for the adapter
 * @param back
 * @param path     the path for the adapter
 * @param openMode the type of file being created
 * @param results  is the list of elements a result from search
 * @param grid     whether to set grid view or list view
 */
public void createViews(ArrayList<LayoutElement> bitmap,boolean back,String path,final OpenMode openMode,boolean results,boolean grid){
  if (bitmap != null) {
synchronized (bitmap) {
      if (GO_BACK_ITEM)       if (!path.equals("String_Node_Str") && (openMode == OpenMode.FILE || openMode == OpenMode.ROOT) && !path.equals(OTGUtil.PREFIX_OTG + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_BOX + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_DROPBOX + "String_Node_Str")) {
        if (bitmap.size() == 0 || !bitmap.get(0).getSize().equals(goback)) {
          Bitmap iconBitmap=BitmapFactory.decodeResource(res,R.drawable.ic_arrow_left_white_24dp);
          bitmap.add(0,utils.newElement(new BitmapDrawable(res,iconBitmap),"String_Node_Str","String_Node_Str","String_Node_Str",goback,0,false,true,"String_Node_Str"));
        }
      }
      if (bitmap.size() == 0 && !results) {
        nofilesview.setVisibility(View.VISIBLE);
        listView.setVisibility(View.GONE);
        mSwipeRefreshLayout.setEnabled(false);
      }
 else {
        mSwipeRefreshLayout.setEnabled(true);
        nofilesview.setVisibility(View.GONE);
        listView.setVisibility(View.VISIBLE);
      }
      putLayoutElements(bitmap);
      if (grid && IS_LIST)       switchToGrid();
 else       if (!grid && !IS_LIST)       switchToList();
      if (adapter == null) {
        adapter=new RecyclerAdapter(ma,utilsProvider,bitmap,ma.getActivity());
      }
 else {
        adapter.setItems(getLayoutElements());
      }
      stopAnims=true;
      this.openMode=openMode;
      if (openMode != OpenMode.CUSTOM)       dataUtils.addHistoryFile(path);
      listView.setAdapter(adapter);
      if (!addheader) {
        listView.removeItemDecoration(dividerItemDecoration);
        addheader=true;
      }
      if (addheader && IS_LIST) {
        dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST,true,SHOW_DIVIDERS);
        listView.addItemDecoration(dividerItemDecoration);
        addheader=false;
      }
      if (!results)       this.results=false;
      CURRENT_PATH=path;
      if (back) {
        if (scrolls.containsKey(CURRENT_PATH)) {
          Bundle b=scrolls.get(CURRENT_PATH);
          if (IS_LIST)           mLayoutManager.scrollToPositionWithOffset(b.getInt("String_Node_Str"),b.getInt("String_Node_Str"));
 else           mLayoutManagerGrid.scrollToPositionWithOffset(b.getInt("String_Node_Str"),b.getInt("String_Node_Str"));
        }
      }
      getMainActivity().updatePaths(no);
      listView.stopScroll();
      fastScroller.setRecyclerView(listView,IS_LIST ? 1 : columns);
      mToolbarContainer.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener(){
        @Override public void onOffsetChanged(        AppBarLayout appBarLayout,        int verticalOffset){
          fastScroller.updateHandlePosition(verticalOffset,112);
        }
      }
);
      fastScroller.registerOnTouchListener(new FastScroller.onTouchListener(){
        @Override public void onTouch(){
          if (stopAnims && adapter != null) {
            stopAnimation();
            stopAnims=false;
          }
        }
      }
);
      if (buttons.getVisibility() == View.VISIBLE)       getMainActivity().bbar(this);
      AppConfig.runInBackground(new Runnable(){
        @Override public void run(){
switch (openMode) {
case ROOT:
case FILE:
            File file=new File(CURRENT_PATH);
          if (file.isDirectory() && file.canRead()) {
            if (customFileObserver != null) {
              customFileObserver.stopWatching();
            }
            customFileObserver=new CustomFileObserver(CURRENT_PATH);
            customFileObserver.startWatching();
          }
        break;
default :
      break;
  }
}
}
);
}
}
 else {
loadlist(home,true,OpenMode.FILE);
}
}

Fixed version (ground truth):
/** 
 * Loading adapter after getting a list of elements
 * @param bitmap   the list of objects for the adapter
 * @param back
 * @param path     the path for the adapter
 * @param openMode the type of file being created
 * @param results  is the list of elements a result from search
 * @param grid     whether to set grid view or list view
 */
public void createViews(ArrayList<LayoutElement> bitmap,boolean back,String path,final OpenMode openMode,boolean results,boolean grid){
  if ((bitmap != null) && (isAdded())) {
synchronized (bitmap) {
      if (GO_BACK_ITEM)       if (!path.equals("String_Node_Str") && (openMode == OpenMode.FILE || openMode == OpenMode.ROOT) && !path.equals(OTGUtil.PREFIX_OTG + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_ONE_DRIVE + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_BOX + "String_Node_Str")&& !path.equals(CloudHandler.CLOUD_PREFIX_DROPBOX + "String_Node_Str")) {
        if (bitmap.size() == 0 || !bitmap.get(0).getSize().equals(goback)) {
          Bitmap iconBitmap=BitmapFactory.decodeResource(res,R.drawable.ic_arrow_left_white_24dp);
          bitmap.add(0,utils.newElement(new BitmapDrawable(res,iconBitmap),"String_Node_Str","String_Node_Str","String_Node_Str",goback,0,false,true,"String_Node_Str"));
        }
      }
      if (bitmap.size() == 0 && !results) {
        nofilesview.setVisibility(View.VISIBLE);
        listView.setVisibility(View.GONE);
        mSwipeRefreshLayout.setEnabled(false);
      }
 else {
        mSwipeRefreshLayout.setEnabled(true);
        nofilesview.setVisibility(View.GONE);
        listView.setVisibility(View.VISIBLE);
      }
      putLayoutElements(bitmap);
      if (grid && IS_LIST)       switchToGrid();
 else       if (!grid && !IS_LIST)       switchToList();
      if (adapter == null) {
        adapter=new RecyclerAdapter(ma,utilsProvider,bitmap,ma.getActivity());
      }
 else {
        adapter.setItems(getLayoutElements());
      }
      stopAnims=true;
      this.openMode=openMode;
      if (openMode != OpenMode.CUSTOM)       dataUtils.addHistoryFile(path);
      listView.setAdapter(adapter);
      if (!addheader) {
        listView.removeItemDecoration(dividerItemDecoration);
        addheader=true;
      }
      if (addheader && IS_LIST) {
        dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST,true,SHOW_DIVIDERS);
        listView.addItemDecoration(dividerItemDecoration);
        addheader=false;
      }
      if (!results)       this.results=false;
      CURRENT_PATH=path;
      if (back) {
        if (scrolls.containsKey(CURRENT_PATH)) {
          Bundle b=scrolls.get(CURRENT_PATH);
          if (IS_LIST)           mLayoutManager.scrollToPositionWithOffset(b.getInt("String_Node_Str"),b.getInt("String_Node_Str"));
 else           mLayoutManagerGrid.scrollToPositionWithOffset(b.getInt("String_Node_Str"),b.getInt("String_Node_Str"));
        }
      }
      getMainActivity().updatePaths(no);
      listView.stopScroll();
      fastScroller.setRecyclerView(listView,IS_LIST ? 1 : columns);
      mToolbarContainer.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener(){
        @Override public void onOffsetChanged(        AppBarLayout appBarLayout,        int verticalOffset){
          fastScroller.updateHandlePosition(verticalOffset,112);
        }
      }
);
      fastScroller.registerOnTouchListener(new FastScroller.onTouchListener(){
        @Override public void onTouch(){
          if (stopAnims && adapter != null) {
            stopAnimation();
            stopAnims=false;
          }
        }
      }
);
      if (buttons.getVisibility() == View.VISIBLE)       getMainActivity().bbar(this);
      AppConfig.runInBackground(new Runnable(){
        @Override public void run(){
switch (openMode) {
case ROOT:
case FILE:
            File file=new File(CURRENT_PATH);
          if (file.isDirectory() && file.canRead()) {
            if (customFileObserver != null) {
              customFileObserver.stopWatching();
            }
            customFileObserver=new CustomFileObserver(CURRENT_PATH);
            customFileObserver.startWatching();
          }
        break;
default :
      break;
  }
}
}
);
}
}
 else {
loadlist(home,true,OpenMode.FILE);
}
}