#vulnerable code 
                                protected void parseRecursive(List<Comment> comments, JSONObject object) throws RetrievalFailedException, RedditError {
    	assert comments != null : "List of comments must be instantiated.";
    	assert object != null : "JSON Object must be instantiated.";
    	
    	// Get the comments in an array
        JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get("children");
        
        // Iterate over the submission results
        JSONObject data;
        Comment comment;
        for (Object anArray : array) {
            data = (JSONObject) anArray;
            
            // Make sure it is of the correct kind
            String kind = safeJsonToString(data.get("kind"));
            if (kind.equals(Kind.COMMENT.value())) {
            	
            	// Contents of the comment
            	data = ((JSONObject) data.get("data"));
            	
	            // Create and add the new comment
	            comment = new Comment(data);
	            comments.add(comment);
	            
	            Object o = data.get("replies");
	            if (o instanceof JSONObject) {
	            	
	            	// Dig towards the replies
	            	JSONObject replies = (JSONObject) o;
	            	parseRecursive(comment.getReplies(), replies);

	            }
	            
            } else if (kind.equals(Kind.MORE.value())) {
            	
	            //data = (JSONObject) data.get("data");
	            //JSONArray children = (JSONArray) data.get("children");
	            //System.out.println("\t+ More children: " + children);
	            
            }

        }
        
    } 
                            #location 16 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                protected void parseRecursive(List<Comment> comments, JSONObject object) throws RetrievalFailedException, RedditError {
    	assert comments != null : "List of comments must be instantiated.";
    	assert object != null : "JSON Object must be instantiated.";
    	
    	// Get the comments in an array
        JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get("children");
        
        // Iterate over the submission results
        JSONObject data;
        Comment comment;
        for (Object anArray : array) {
            data = (JSONObject) anArray;
            
            // Make sure it is of the correct kind
            String kind = safeJsonToString(data.get("kind"));
			if (kind != null) {
				if (kind.equals(Kind.COMMENT.value())) {

                    // Contents of the comment
                    data = ((JSONObject) data.get("data"));

                    // Create and add the new comment
                    comment = new Comment(data);
                    comments.add(comment);

                    Object o = data.get("replies");
                    if (o instanceof JSONObject) {

                        // Dig towards the replies
                        JSONObject replies = (JSONObject) o;
                        parseRecursive(comment.getReplies(), replies);

                    }

                } else if (kind.equals(Kind.MORE.value())) {

                    //data = (JSONObject) data.get("data");
                    //JSONArray children = (JSONArray) data.get("children");
                    //System.out.println("\t+ More children: " + children);

                }
			}

		}
        
    }