Program: 52802
Project: 52802
Buggy source:
private void addCommentsGutter(DiffPanelImpl diffPanel,FilePath filePath,TreeMap<String,List<CommentInfo>> comments,ChangeInfo changeInfo,Project project){
  String repositoryPath=getGitRepositoryPathForChange(project,changeInfo);
  List<CommentInfo> fileComments=Lists.newArrayList();
  for (  Map.Entry<String,List<CommentInfo>> entry : comments.entrySet()) {
    if (isForCurrentFile(filePath,entry.getKey(),repositoryPath)) {
      fileComments=entry.getValue();
      break;
    }
  }
  Iterable<CommentInput> commentInputsFromSink=reviewCommentSink.getCommentsForChange(changeInfo.getId());
  for (  CommentInput commentInput : commentInputsFromSink) {
    if (isForCurrentFile(filePath,commentInput.getPath(),repositoryPath)) {
      fileComments.add(commentInput.toCommentInfo());
    }
  }
  for (  CommentInfo fileComment : fileComments) {
    MarkupModel markup;
    if (fileComment.getSide() != null && fileComment.getSide().equals(CommentBase.CommentSide.PARENT)) {
      markup=diffPanel.getEditor1().getMarkupModel();
    }
 else {
      markup=diffPanel.getEditor2().getMarkupModel();
    }
    int lineCount=markup.getDocument().getLineCount();
    int line=fileComment.getLine() - 1;
    if (line < 0) {
      line=0;
    }
    if (line > lineCount - 1) {
      line=lineCount - 1;
    }
    final RangeHighlighter highlighter=markup.addLineHighlighter(line,HighlighterLayer.ERROR + 1,null);
    highlighter.setGutterIconRenderer(new CommentGutterIconRenderer(fileComment,reviewCommentSink,changeInfo,highlighter,markup));
  }
}

Fixed version (ground truth):
private void addCommentsGutter(DiffPanelImpl diffPanel,FilePath filePath,TreeMap<String,List<CommentInfo>> comments,ChangeInfo changeInfo,Project project){
  String repositoryPath=getGitRepositoryPathForChange(project,changeInfo);
  List<CommentInfo> fileComments=Lists.newArrayList();
  for (  Map.Entry<String,List<CommentInfo>> entry : comments.entrySet()) {
    if (isForCurrentFile(filePath,entry.getKey(),repositoryPath)) {
      fileComments=entry.getValue();
      break;
    }
  }
  Iterable<CommentInput> commentInputsFromSink=reviewCommentSink.getCommentsForChange(changeInfo.getId());
  for (  CommentInput commentInput : commentInputsFromSink) {
    if (isForCurrentFile(filePath,commentInput.getPath(),repositoryPath)) {
      fileComments.add(commentInput.toCommentInfo());
    }
  }
  for (  CommentInfo fileComment : fileComments) {
    MarkupModel markup;
    if (fileComment.getSide() != null && fileComment.getSide().equals(CommentBase.CommentSide.PARENT)) {
      markup=diffPanel.getEditor1().getMarkupModel();
    }
 else {
      markup=diffPanel.getEditor2().getMarkupModel();
    }
    int lineCount=markup.getDocument().getLineCount();
    if (lineCount <= 0) {
      return;
    }
    int line=fileComment.getLine() - 1;
    if (line < 0) {
      line=0;
    }
    if (line > lineCount - 1) {
      line=lineCount - 1;
    }
    final RangeHighlighter highlighter=markup.addLineHighlighter(line,HighlighterLayer.ERROR + 1,null);
    highlighter.setGutterIconRenderer(new CommentGutterIconRenderer(fileComment,reviewCommentSink,changeInfo,highlighter,markup));
  }
}