#vulnerable code 
                             private void renderDocument(int pos) throws CorruptIndexException,
			IOException, ParseException, SyntaxError {
		writer.print("\t<doc score=\"");
		writer.print(result.getDocs()[pos].score);
		writer.print("\" pos=\"");
		writer.print(pos);
		writer.println("\">");
		ResultDocument doc = result.getDocument(pos);
		for (Field field : searchRequest.getReturnFieldList())
			renderField(doc, field);
		for (HighlightField field : searchRequest.getHighlightFieldList())
			renderHighlightValue(doc, field);

		int cc = result.getCollapseCount(pos);
		if (cc > 0) {
			writer.print("\t\t<collapseCount>");
			writer.print(cc);
			writer.println("</collapseCount>");
		}
		writer.println("\t</doc>");
	} 
                            #location 10 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             private void renderDocument(int pos) throws CorruptIndexException,
			IOException, ParseException, SyntaxError {
		writer.print("\t<doc score=\"");
		writer.print(result.getScore(pos));
		writer.print("\" pos=\"");
		writer.print(pos);
		writer.println("\">");
		ResultDocument doc = result.getDocument(pos);
		for (Field field : searchRequest.getReturnFieldList())
			renderField(doc, field);
		for (HighlightField field : searchRequest.getHighlightFieldList())
			renderHighlightValue(doc, field);

		int cc = result.getCollapseCount(pos);
		if (cc > 0) {
			writer.print("\t\t<collapseCount>");
			writer.print(cc);
			writer.println("</collapseCount>");
		}
		writer.println("\t</doc>");
	}