#vulnerable code 
                              @Override
  public int compare(Solution solution1, Solution solution2) {
    if (solution1 == null) {
      return 1;
    } else if (solution2 == null) {
      return -1;
    }

    if ((int)solution1.getAlgorithmAttributes().getAttribute("Rank") < (int)solution2.getAlgorithmAttributes().getAttribute("Rank")) {
      return -1;
    }

    if ((int)solution1.getAlgorithmAttributes().getAttribute("Rank") > (int)solution2.getAlgorithmAttributes().getAttribute("Rank")) {
      return 1;
    }

    return 0;
  } 
                            #location 9 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                              @Override
  public int compare(Solution solution1, Solution solution2) {
    if (solution1 == null) {
      return 1;
    } else if (solution2 == null) {
      return -1;
    }

    if (NSGAIIAttr.getAttributes(solution1).getRank() < NSGAIIAttr.getAttributes(solution2).getRank()) {
      return -1;
    }

    if (NSGAIIAttr.getAttributes(solution1).getRank() > NSGAIIAttr.getAttributes(solution2).getRank()) {
      return 1;
    }

    return 0;
  }