Program: 69347
Project: 69347
Buggy source:
private void setupContent(UserRequest ureq,WindowControl wControl,UserCourseEnvironment userCourseEnv,CourseNode courseNode){
  ownIdentity=userCourseEnv.getIdentityEnvironment().getIdentity();
  AssessmentEntry ownEntry=userCourseEnv.getCourseEnvironment().getAssessmentManager().getAssessmentEntry(courseNode,ownIdentity);
  boolean adminORcoach=userCourseEnv.isAdmin() || userCourseEnv.isCoach();
  if (ureq.getUserSession().getRoles().isGuestOnly()) {
    viewHighscore=false;
    return;
  }
  if (!adminORcoach && (ownEntry == null || (ownEntry != null && ownEntry.getScore() == null))) {
    viewHighscore=false;
    return;
  }
  List<AssessmentEntry> assessEntries=userCourseEnv.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(courseNode);
  if (assessEntries.isEmpty()) {
    viewHighscore=false;
    return;
  }
  ModuleConfiguration config=courseNode.getModuleConfiguration();
  viewHighscore=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HIGHSCORE);
  if (!viewHighscore) {
    return;
  }
  Date start=config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_DATESTART) != null ? (Date)config.get(HighScoreEditController.CONFIG_KEY_DATESTART) : null;
  if (start != null && start.after(new Date())) {
    viewHighscore=false;
    return;
  }
  viewTable=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_LISTING);
  viewHistogram=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HISTOGRAM);
  viewPosition=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_POSITION);
  viewPodium=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_PODIUM);
  anonymous=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_ANONYMIZE);
  int bestOnly=config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_BESTONLY) != null ? (int)config.get(HighScoreEditController.CONFIG_KEY_BESTONLY) : 0;
  tableSize=bestOnly != 0 ? (int)config.get(HighScoreEditController.CONFIG_KEY_NUMUSER) : assessEntries.size();
  initLists();
  lowerBorder=(Float)config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
  upperBorder=(Float)config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
  allScores=highScoreManager.sortRankByScore(assessEntries,allMembers,ownIdMembers,allPodium,ownIdIndices,tableSize,ownIdentity,userManager);
  doLoadShowConfig(ureq);
  initForm(ureq);
}

Fixed version (ground truth):
private void setupContent(UserRequest ureq,UserCourseEnvironment userCourseEnv,CourseNode courseNode){
  ownIdentity=userCourseEnv.getIdentityEnvironment().getIdentity();
  AssessmentEntry ownEntry=userCourseEnv.getCourseEnvironment().getAssessmentManager().getAssessmentEntry(courseNode,ownIdentity);
  boolean adminORcoach=userCourseEnv.isAdmin() || userCourseEnv.isCoach();
  if (ureq.getUserSession().getRoles().isGuestOnly()) {
    viewHighscore=false;
    return;
  }
  if (!adminORcoach && (ownEntry == null || (ownEntry != null && ownEntry.getScore() == null))) {
    viewHighscore=false;
    return;
  }
  List<AssessmentEntry> assessEntries=userCourseEnv.getCourseEnvironment().getAssessmentManager().getAssessmentEntries(courseNode);
  if (assessEntries.isEmpty()) {
    viewHighscore=false;
    return;
  }
  ModuleConfiguration config=courseNode.getModuleConfiguration();
  viewHighscore=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HIGHSCORE);
  if (!viewHighscore) {
    return;
  }
  Date start=config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_DATESTART) != null ? (Date)config.get(HighScoreEditController.CONFIG_KEY_DATESTART) : null;
  if (start != null && start.after(new Date())) {
    viewHighscore=false;
    return;
  }
  viewTable=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_LISTING);
  viewHistogram=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_HISTOGRAM);
  viewPosition=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_POSITION);
  viewPodium=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_PODIUM);
  anonymous=config.getBooleanSafe(HighScoreEditController.CONFIG_KEY_ANONYMIZE);
  int bestOnly=config.getBooleanEntry(HighScoreEditController.CONFIG_KEY_BESTONLY) != null ? (int)config.get(HighScoreEditController.CONFIG_KEY_BESTONLY) : 0;
  tableSize=bestOnly != 0 ? (int)config.get(HighScoreEditController.CONFIG_KEY_NUMUSER) : assessEntries.size();
  initLists();
  lowerBorder=(Float)config.get(MSCourseNode.CONFIG_KEY_SCORE_MIN);
  upperBorder=(Float)config.get(MSCourseNode.CONFIG_KEY_SCORE_MAX);
  allScores=highScoreManager.sortRankByScore(assessEntries,allMembers,ownIdMembers,allPodium,ownIdIndices,tableSize,ownIdentity,userManager);
  doLoadShowConfig(ureq);
  initForm(ureq);
}