#fixed code
                              protected static Set<String> getExpiredJobs(HelixDataAccessor dataAccessor,
      HelixPropertyStore propertyStore, WorkflowConfig workflowConfig,
      WorkflowContext workflowContext) {
    Set<String> expiredJobs = new HashSet<String>();

    if (workflowContext != null) {
      Map<String, TaskState> jobStates = workflowContext.getJobStates();
      for (String job : workflowConfig.getJobDag().getAllNodes()) {
        JobConfig jobConfig = TaskUtil.getJobConfig(dataAccessor, job);
        JobContext jobContext = TaskUtil.getJobContext(propertyStore, job);
        if (jobConfig == null) {
          LOG.error(String.format("Job %s exists in JobDAG but JobConfig is missing!", job));
          continue;
        }
        long expiry = jobConfig.getExpiry();
        if (expiry == workflowConfig.DEFAULT_EXPIRY || expiry < 0) {
          expiry = workflowConfig.getExpiry();
        }
        if (jobContext != null && jobStates.get(job) == TaskState.COMPLETED) {
          if (System.currentTimeMillis() >= jobContext.getFinishTime() + expiry) {
            expiredJobs.add(job);
          }
        }
      }
    }
    return expiredJobs;
  }
#vulnerable code 
                              protected static Set<String> getExpiredJobs(HelixDataAccessor dataAccessor,
      HelixPropertyStore propertyStore, WorkflowConfig workflowConfig,
      WorkflowContext workflowContext) {
    Set<String> expiredJobs = new HashSet<String>();

    if (workflowContext != null) {
      Map<String, TaskState> jobStates = workflowContext.getJobStates();
      for (String job : workflowConfig.getJobDag().getAllNodes()) {
        JobConfig jobConfig = TaskUtil.getJobConfig(dataAccessor, job);
        JobContext jobContext = TaskUtil.getJobContext(propertyStore, job);
        long expiry = jobConfig.getExpiry();
        if (expiry == workflowConfig.DEFAULT_EXPIRY || expiry < 0) {
          expiry = workflowConfig.getExpiry();
        }
        if (jobContext != null && jobStates.get(job) == TaskState.COMPLETED) {
          if (System.currentTimeMillis() >= jobContext.getFinishTime() + expiry) {
            expiredJobs.add(job);
          }
        }
      }
    }
    return expiredJobs;
  } 
                            #location 11 
                            #vulnerability type NULL_DEREFERENCE