#vulnerable code 
                             protected void insertKeyValues(KeyValues kv) throws IOException {
		if (kv.key != null) {
			if (inGraph) {
				if (kv.key.equals("node") || kv.key.equals("add-node")) {
					handleAddNode(kv);
				} else if (kv.key.equals("edge") || kv.key.equals("add-edge")) {
					handleAddEdge(kv);
				} else if (kv.key.equals("del-node") || kv.key.equals("-node")) {
					handleDelNode(kv);
				} else if (kv.key.equals("del-edge") || kv.key.equals("-edge")) {
					handleDelEdge(kv);
				} else if (kv.key.equals("change-node")
						|| kv.key.equals("+node")) {
					handleChangeNode(kv);
				} else if (kv.key.equals("change-edge")
						|| kv.key.equals("+edge")) {
					handleChangeEdge(kv);
				} else if (kv.key.equals("step")) {
					handleStep(kv);
				} else if (kv.key.equals("directed")) {
					setDirected(getBoolean((String) kv.get("directed")));
				} else {
					if (kv.key.startsWith("-")) {
						gml.sendAttributeChangedEvent(sourceId, sourceId,
								ElementType.GRAPH, kv.key.substring(1),
								AttributeChangeEvent.REMOVE, null, null);
					} else {
						gml.sendAttributeChangedEvent(sourceId, sourceId,
								ElementType.GRAPH, kv.key,
								AttributeChangeEvent.ADD, null,
								compositeAttribute(kv));
					}
				}
			} else {
				// XXX Should we consider these events pertain to the graph ?
				// XXX

				if (kv.key.startsWith("-")) {
					gml.sendAttributeChangedEvent(sourceId, sourceId,
							ElementType.GRAPH, kv.key.substring(1),
							AttributeChangeEvent.REMOVE, null, null);
				} else {
					gml.sendAttributeChangedEvent(sourceId, sourceId,
							ElementType.GRAPH, kv.key,
							AttributeChangeEvent.ADD, null,
							compositeAttribute(kv));
				}
			}
		}
	} 
                            #location 21 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             protected void insertKeyValues(KeyValues kv) throws IOException {
		if (kv.key != null) {
			if (inGraph) {
				if (kv.key.equals("node") || kv.key.equals("add-node")) {
					handleAddNode(kv);
				} else if (kv.key.equals("edge") || kv.key.equals("add-edge")) {
					handleAddEdge(kv);
				} else if (kv.key.equals("del-node") || kv.key.equals("-node")) {
					handleDelNode(kv);
				} else if (kv.key.equals("del-edge") || kv.key.equals("-edge")) {
					handleDelEdge(kv);
				} else if (kv.key.equals("change-node")
						|| kv.key.equals("+node")) {
					handleChangeNode(kv);
				} else if (kv.key.equals("change-edge")
						|| kv.key.equals("+edge")) {
					handleChangeEdge(kv);
				} else if (kv.key.equals("step")) {
					handleStep(kv);
				} else if (kv.key.equals("directed")) {
					setDirected(getBoolean(kv.get("directed")));
				} else {
					if (kv.key.startsWith("-")) {
						gml.sendAttributeChangedEvent(sourceId, sourceId,
								ElementType.GRAPH, kv.key.substring(1),
								AttributeChangeEvent.REMOVE, null, null);
					} else {
						gml.sendAttributeChangedEvent(sourceId, sourceId,
								ElementType.GRAPH, kv.key,
								AttributeChangeEvent.ADD, null,
								compositeAttribute(kv));
					}
				}
			} else {
				// XXX Should we consider these events pertain to the graph ?
				// XXX

				if (kv.key.startsWith("-")) {
					gml.sendAttributeChangedEvent(sourceId, sourceId,
							ElementType.GRAPH, kv.key.substring(1),
							AttributeChangeEvent.REMOVE, null, null);
				} else {
					gml.sendAttributeChangedEvent(sourceId, sourceId,
							ElementType.GRAPH, kv.key,
							AttributeChangeEvent.ADD, null,
							compositeAttribute(kv));
				}
			}
		}
	}