Program: 34017
Project: 34017
Buggy source:
private void loadCamerasToActionBar(){
  String[] cameraNames;
  final ArrayList<EvercamCamera> onlineCameraList=new ArrayList<>();
  final ArrayList<EvercamCamera> cameraList;
  if (PrefsManager.showOfflineCameras(VideoActivity.this)) {
    cameraList=AppData.evercamCameraList;
  }
 else {
    for (    EvercamCamera evercamCamera : AppData.evercamCameraList) {
      if (!evercamCamera.isOffline()) {
        onlineCameraList.add(evercamCamera);
      }
    }
    cameraList=onlineCameraList;
  }
  cameraNames=getCameraNameArray(cameraList);
  CameraListAdapter adapter=new CameraListAdapter(VideoActivity.this,R.layout.live_view_spinner,R.id.spinner_camera_name_text,cameraNames,cameraList);
  mCameraListSpinner.setAdapter(adapter);
  mCameraListSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (timeCounter != null) {
        timeCounter.stop();
        timeCounter=null;
      }
      if (browseJpgTask != null && browseJpgTask.getStatus() != AsyncTask.Status.RUNNING) {
        browseJpgTask.cancel(true);
      }
      browseJpgTask=null;
      showImagesVideo=false;
      evercamCamera=cameraList.get(position);
      showPtzControl(false);
      if (evercamCamera.isOffline()) {
        offlineTextView.setVisibility(View.VISIBLE);
        progressView.setVisibility(View.GONE);
        surfaceView.setVisibility(View.GONE);
        imageView.setVisibility(View.GONE);
      }
 else {
        offlineTextView.setVisibility(View.GONE);
        setCameraForPlaying(cameraList.get(position));
        createPlayer(evercamCamera);
        if (evercamCamera.hasModel()) {
          new CheckOnvifTask(VideoActivity.this,evercamCamera).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mCameraListSpinner.setSelection(defaultCameraIndex);
}

Fixed version (ground truth):
private void loadCamerasToActionBar(){
  String[] cameraNames;
  final ArrayList<EvercamCamera> onlineCameraList=new ArrayList<>();
  final ArrayList<EvercamCamera> cameraList;
  if (PrefsManager.showOfflineCameras(VideoActivity.this)) {
    cameraList=AppData.evercamCameraList;
  }
 else {
    for (    EvercamCamera evercamCamera : AppData.evercamCameraList) {
      if (!evercamCamera.isOffline()) {
        onlineCameraList.add(evercamCamera);
      }
    }
    cameraList=onlineCameraList;
  }
  cameraNames=getCameraNameArray(cameraList);
  CameraListAdapter adapter=new CameraListAdapter(VideoActivity.this,R.layout.live_view_spinner,R.id.spinner_camera_name_text,cameraNames,cameraList);
  mCameraListSpinner.setAdapter(adapter);
  mCameraListSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){
    @Override public void onItemSelected(    AdapterView<?> parent,    View view,    int position,    long id){
      if (timeCounter != null) {
        timeCounter.stop();
        timeCounter=null;
      }
      if (browseJpgTask != null && browseJpgTask.getStatus() != AsyncTask.Status.RUNNING) {
        browseJpgTask.cancel(true);
      }
      browseJpgTask=null;
      showImagesVideo=false;
      evercamCamera=cameraList.get(position);
      startingCameraID=evercamCamera.getCameraId();
      showPtzControl(false);
      if (evercamCamera.isOffline()) {
        offlineTextView.setVisibility(View.VISIBLE);
        progressView.setVisibility(View.GONE);
        surfaceView.setVisibility(View.GONE);
        imageView.setVisibility(View.GONE);
      }
 else {
        offlineTextView.setVisibility(View.GONE);
        setCameraForPlaying(cameraList.get(position));
        createPlayer(evercamCamera);
        if (evercamCamera.hasModel()) {
          new CheckOnvifTask(VideoActivity.this,evercamCamera).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
      }
    }
    @Override public void onNothingSelected(    AdapterView<?> parent){
    }
  }
);
  mCameraListSpinner.setSelection(defaultCameraIndex);
}