Program: 86413
Project: 86413
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.timelapse);
  title=(EditText)findViewById(R.id.create_timelapse_title);
  cameraButton=(ImageButton)findViewById(R.id.camera_button);
  exportButton=(ImageButton)findViewById(R.id.export_button);
  cameraButton.setOnClickListener(cameraButtonListener);
  exportButton.setOnClickListener(exportButtonListener);
  preview=(ImageView)findViewById(R.id.previewImage);
  seekBar=(SeekBar)findViewById(R.id.seekBar);
  tla=(TimeLapseApplication)this.getApplicationContext();
  Intent intent=getIntent();
  _id=intent.getExtras().getInt("String_Node_Str");
  Log.d("String_Node_Str","String_Node_Str" + String.valueOf(_id));
  Display display=getWindowManager().getDefaultDisplay();
  preview_width=display.getWidth();
  preview_height=(int)(((double)preview_width * 3) / 4);
  Cursor cursor=tla.getTimeLapseById(_id,null);
  if (cursor != null && cursor.moveToFirst()) {
    title.setText(cursor.getString(cursor.getColumnIndex(SQLiteWrapper.COLUMN_NAME)));
    originalTitle=title.getText().toString();
    if (!cursor.isNull(cursor.getColumnIndex(SQLiteWrapper.COLUMN_THUMBNAIL_PATH))) {
      bmf=new BitmapFactory();
      preview.setImageBitmap(bmf.decodeFile(cursor.getString(cursor.getColumnIndexOrThrow(SQLiteWrapper.COLUMN_THUMBNAIL_PATH))));
      preview.setVisibility(View.VISIBLE);
      if (!cursor.isNull(cursor.getColumnIndex(SQLiteWrapper.COLUMN_IMAGE_COUNT))) {
        seekBar.setMax(cursor.getInt(cursor.getColumnIndex(SQLiteWrapper.COLUMN_IMAGE_COUNT)) - 1);
        if (seekBar.getMax() > 1) {
          Log.v("String_Node_Str",String.valueOf(seekBar.getMax()));
          seekBar.setVisibility(View.VISIBLE);
          seekBar.setOnSeekBarChangeListener(onSeekBarChangeListener);
        }
        timelapse_dir=cursor.getString(cursor.getColumnIndex(SQLiteWrapper.COLUMN_DIRECTORY_PATH));
      }
    }
  }
 else {
    exportButton.setEnabled(false);
    cameraButton.setEnabled(false);
  }
  preview_is_fresh=true;
  cursor.close();
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.timelapse);
  title=(EditText)findViewById(R.id.create_timelapse_title);
  cameraButton=(ImageButton)findViewById(R.id.camera_button);
  exportButton=(ImageButton)findViewById(R.id.export_button);
  cameraButton.setOnClickListener(cameraButtonListener);
  exportButton.setOnClickListener(exportButtonListener);
  preview=(ImageView)findViewById(R.id.previewImage);
  seekBar=(SeekBar)findViewById(R.id.seekBar);
  tla=(TimeLapseApplication)this.getApplicationContext();
  Intent intent=getIntent();
  _id=intent.getExtras().getInt("String_Node_Str");
  Log.d("String_Node_Str","String_Node_Str" + String.valueOf(_id));
  Display display=getWindowManager().getDefaultDisplay();
  preview_width=display.getWidth();
  preview_height=(int)(((double)preview_width * 3) / 4);
  Cursor cursor=tla.getTimeLapseById(_id,null);
  if (cursor != null && cursor.moveToFirst()) {
    title.setText(cursor.getString(cursor.getColumnIndex(SQLiteWrapper.COLUMN_NAME)));
    originalTitle=title.getText().toString();
    if (!cursor.isNull(cursor.getColumnIndex(SQLiteWrapper.COLUMN_THUMBNAIL_PATH))) {
      bmf=new BitmapFactory();
      preview.setImageBitmap(bmf.decodeFile(cursor.getString(cursor.getColumnIndexOrThrow(SQLiteWrapper.COLUMN_THUMBNAIL_PATH))));
      preview.setVisibility(View.VISIBLE);
      if (!cursor.isNull(cursor.getColumnIndex(SQLiteWrapper.COLUMN_IMAGE_COUNT))) {
        int seekBarMax=0;
        seekBarMax=cursor.getInt(cursor.getColumnIndex(SQLiteWrapper.COLUMN_IMAGE_COUNT)) - 1;
        Log.d("String_Node_Str",String.valueOf(seekBarMax));
        seekBar.setMax(cursor.getInt(cursor.getColumnIndex(SQLiteWrapper.COLUMN_IMAGE_COUNT)) - 1);
        if (seekBar.getMax() > 0) {
          Log.v("String_Node_Str",String.valueOf(seekBar.getMax()));
          seekBar.setVisibility(View.VISIBLE);
          seekBar.setOnSeekBarChangeListener(onSeekBarChangeListener);
        }
        timelapse_dir=cursor.getString(cursor.getColumnIndex(SQLiteWrapper.COLUMN_DIRECTORY_PATH));
      }
    }
  }
 else {
    exportButton.setEnabled(false);
    cameraButton.setEnabled(false);
  }
  preview_is_fresh=true;
  cursor.close();
}