Program: 34143
Project: 34143
Buggy source:
public boolean addAllCameraViews(boolean reloadImages){
  try {
    SharedPreferences sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
    camerasPerRow=PrefsManager.getCameraPerRow(sharedPrefs,camerasPerRow);
    io.evercam.androidapp.custom.FlowLayout camsLineView=(io.evercam.androidapp.custom.FlowLayout)this.findViewById(R.id.camsLV);
    Display display=getWindowManager().getDefaultDisplay();
    int screen_width=display.getWidth();
    int index=0;
    totalCamerasInGrid=0;
    for (    EvercamCamera evercamCamera : AppData.evercamCameraList) {
      LinearLayout cameraListLayout=new LinearLayout(this);
      int indexPlus=index + 1;
      if (reloadImages)       evercamCamera.loadingStatus=ImageLoadingStatus.not_started;
      CameraLayout cameraLayout=new CameraLayout(this,evercamCamera);
      LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
      params.width=((indexPlus % camerasPerRow == 0) ? (screen_width - (index % camerasPerRow) * (screen_width / camerasPerRow)) : screen_width / camerasPerRow);
      params.height=(int)(params.width / (1.25));
      cameraLayout.setLayoutParams(params);
      cameraListLayout.addView(cameraLayout);
      camsLineView.addView(cameraListLayout,new io.evercam.androidapp.custom.FlowLayout.LayoutParams(0,0));
      index++;
      totalCamerasInGrid++;
    }
    if (this.getActionBar() != null)     this.getActionBar().setHomeButtonEnabled(true);
    startgCMRegisterActions();
    if (refresh != null)     refresh.setActionView(null);
    return true;
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    UIUtils.GetAlertDialog(CamerasActivity.this,"String_Node_Str",Constants.ErrorMessageGeneric).show();
    if (Constants.isAppTrackingEnabled)     BugSenseHandler.sendException(e);
  }
  return false;
}

Fixed version (ground truth):
public boolean addAllCameraViews(boolean reloadImages){
  try {
    SharedPreferences sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
    camerasPerRow=PrefsManager.getCameraPerRow(sharedPrefs,camerasPerRow);
    io.evercam.androidapp.custom.FlowLayout camsLineView=(io.evercam.androidapp.custom.FlowLayout)this.findViewById(R.id.camsLV);
    Display display=getWindowManager().getDefaultDisplay();
    int screen_width=display.getWidth();
    int index=0;
    totalCamerasInGrid=0;
    for (    EvercamCamera evercamCamera : AppData.evercamCameraList) {
      LinearLayout cameraListLayout=new LinearLayout(this);
      int indexPlus=index + 1;
      if (reloadImages)       evercamCamera.loadingStatus=ImageLoadingStatus.not_started;
      CameraLayout cameraLayout=new CameraLayout(this,evercamCamera);
      LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
      params.width=((indexPlus % camerasPerRow == 0) ? (screen_width - (index % camerasPerRow) * (screen_width / camerasPerRow)) : screen_width / camerasPerRow);
      params.height=(int)(params.width / (1.25));
      cameraLayout.setLayoutParams(params);
      cameraListLayout.addView(cameraLayout);
      camsLineView.addView(cameraListLayout,new io.evercam.androidapp.custom.FlowLayout.LayoutParams(0,0));
      index++;
      totalCamerasInGrid++;
    }
    if (this.getActionBar() != null)     this.getActionBar().setHomeButtonEnabled(true);
    if (refresh != null)     refresh.setActionView(null);
    return true;
  }
 catch (  Exception e) {
    Log.e(TAG,e.toString(),e);
    UIUtils.GetAlertDialog(CamerasActivity.this,"String_Node_Str",Constants.ErrorMessageGeneric).show();
    if (Constants.isAppTrackingEnabled)     BugSenseHandler.sendException(e);
  }
  return false;
}