Program: 187195
Project: 187195
Buggy source:
private void initActivityList(){
  mCardView=(CardUI)findViewById(R.id.cardsview);
  if (mCardView == null)   return;
  mCardView.clearCards();
  mCardView.setSwipeable(false);
  ArrayList<ActivityEntry> alActivity=new ArrayList<ActivityEntry>();
  for (int i=mLessonsCompleted.size() - 1; i > mLessonsCompleted.size() - 4 && i > -1; i--) {
    Lesson lesson=mLessonsCompleted.get(i);
    MyCard card=null;
    if (lesson.mStatus == Lesson.STATUS_COMPLETE) {
      card=new MyCard(getString(R.string.lessons_congratulations_you_have_completed_the_lesson_),lesson.mTitle);
    }
 else     if (lesson.mStatus == Lesson.STATUS_IN_PROGRESS) {
      card=new MyCard(getString(R.string.you_began_a_new_lesson),lesson.mTitle);
    }
    if (lesson.mImage != null)     card.setImage(BitmapDrawable.createFromPath(lesson.mImage));
    card.setIcon(R.drawable.ic_home_lesson);
    card.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startActivity(new Intent(HomeActivity.this,LessonsActivity.class));
      }
    }
);
    Date cardDate=new Date();
    if (lesson.mStatusModified != null)     cardDate=lesson.mStatusModified;
    ActivityEntry ae=new ActivityEntry(card,cardDate);
    alActivity.add(ae);
  }
  for (int i=mListProjects.size() - 1; i > mListProjects.size() - 4 && i > -1; i--) {
    Project project=mListProjects.get(i);
    Drawable img=null;
    Date cardDate=new Date();
    for (int n=0; n < project.getScenesAsArray().length && img == null; n++) {
      Media[] mediaList=project.getScenesAsArray()[n].getMediaAsArray();
      if (mediaList != null && mediaList.length > 0) {
        for (        Media media : mediaList)         if (media != null) {
          Bitmap bmp=getThumbnail(media);
          if (bmp != null) {
            img=new BitmapDrawable(getResources(),bmp);
            cardDate=new Date(new File(media.getPath()).getParentFile().lastModified());
            break;
          }
        }
      }
    }
    if (img != null) {
      MyCard card=new MyCard(getString(R.string.title_activity_new_story),project.getTitle());
      card.setImage(img);
      card.setId(i);
      card.setOnClickListener(new OnClickListener(){
        @Override public void onClick(        View v){
          showProject(v.getId());
        }
      }
);
      ActivityEntry ae=new ActivityEntry(card,cardDate);
      alActivity.add(ae);
      if (project.getStoryType() == Project.STORY_TYPE_VIDEO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_video);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_PHOTO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_photo);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_AUDIO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_audio);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_ESSAY) {
        card.setIcon(R.drawable.btn_toggle_ic_list_essay);
      }
    }
 else {
      MyCard card=new MyCard(getString(R.string.title_activity_new_story),project.getTitle());
      card.setId(i);
      card.setOnClickListener(new OnClickListener(){
        @Override public void onClick(        View v){
          showProject(v.getId());
        }
      }
);
      if (project.getStoryType() == Project.STORY_TYPE_VIDEO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_video);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_PHOTO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_photo);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_AUDIO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_audio);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_ESSAY) {
        card.setIcon(R.drawable.btn_toggle_ic_list_essay);
      }
      ActivityEntry ae=new ActivityEntry(card,cardDate);
      alActivity.add(ae);
    }
  }
  Collections.sort(alActivity);
  for (  ActivityEntry ae : alActivity)   mCardView.addCard(ae.card);
  mCardView.refresh();
}

Fixed version (ground truth):
private void initActivityList(){
  mCardView=(CardUI)findViewById(R.id.cardsview);
  if (mCardView == null)   return;
  mCardView.clearCards();
  mCardView.setSwipeable(false);
  ArrayList<ActivityEntry> alActivity=new ArrayList<ActivityEntry>();
  for (int i=mLessonsCompleted.size() - 1; i > mLessonsCompleted.size() - 4 && i > -1; i--) {
    Lesson lesson=mLessonsCompleted.get(i);
    MyCard card=null;
    if (lesson.mStatus == Lesson.STATUS_COMPLETE) {
      card=new MyCard(getString(R.string.lessons_congratulations_you_have_completed_the_lesson_),lesson.mTitle);
    }
 else     if (lesson.mStatus == Lesson.STATUS_IN_PROGRESS) {
      card=new MyCard(getString(R.string.you_began_a_new_lesson),lesson.mTitle);
    }
    if (lesson.mImage != null)     card.setImage(BitmapDrawable.createFromPath(lesson.mImage));
    card.setIcon(R.drawable.ic_home_lesson);
    card.setOnClickListener(new OnClickListener(){
      @Override public void onClick(      View v){
        startActivity(new Intent(HomeActivity.this,LessonsActivity.class));
      }
    }
);
    Date cardDate=new Date();
    if (lesson.mStatusModified != null)     cardDate=lesson.mStatusModified;
    ActivityEntry ae=new ActivityEntry(card,cardDate);
    alActivity.add(ae);
  }
  for (int i=mListProjects.size() - 1; i > mListProjects.size() - 4 && i > -1; i--) {
    Project project=mListProjects.get(i);
    Drawable img=null;
    Date cardDate=new Date();
    for (int n=0; n < project.getScenesAsArray().length && img == null; n++) {
      Media[] mediaList=project.getScenesAsArray()[n].getMediaAsArray();
      if (mediaList != null && mediaList.length > 0) {
        for (        Media media : mediaList)         if (media != null) {
          Bitmap bmp=Media.getThumbnail(this,media,project);
          if (bmp != null) {
            img=new BitmapDrawable(getResources(),bmp);
            cardDate=new Date(new File(media.getPath()).getParentFile().lastModified());
            break;
          }
        }
      }
    }
    if (img != null) {
      MyCard card=new MyCard(getString(R.string.title_activity_new_story),project.getTitle());
      card.setImage(img);
      card.setId(i);
      card.setOnClickListener(new OnClickListener(){
        @Override public void onClick(        View v){
          showProject(v.getId());
        }
      }
);
      ActivityEntry ae=new ActivityEntry(card,cardDate);
      alActivity.add(ae);
      if (project.getStoryType() == Project.STORY_TYPE_VIDEO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_video);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_PHOTO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_photo);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_AUDIO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_audio);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_ESSAY) {
        card.setIcon(R.drawable.btn_toggle_ic_list_essay);
      }
    }
 else {
      MyCard card=new MyCard(getString(R.string.title_activity_new_story),project.getTitle());
      card.setId(i);
      card.setOnClickListener(new OnClickListener(){
        @Override public void onClick(        View v){
          showProject(v.getId());
        }
      }
);
      if (project.getStoryType() == Project.STORY_TYPE_VIDEO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_video);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_PHOTO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_photo);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_AUDIO) {
        card.setIcon(R.drawable.btn_toggle_ic_list_audio);
      }
 else       if (project.getStoryType() == Project.STORY_TYPE_ESSAY) {
        card.setIcon(R.drawable.btn_toggle_ic_list_essay);
      }
      ActivityEntry ae=new ActivityEntry(card,cardDate);
      alActivity.add(ae);
    }
  }
  Collections.sort(alActivity);
  for (  ActivityEntry ae : alActivity)   mCardView.addCard(ae.card);
  mCardView.refresh();
}