#vulnerable code 
                             private TreeModel<T> getPreviousSibling(TreeModel<T> parent, int index) {
		if (isRoot()) {
			return null;
		}
		else if (index >= 0) {
			return parent.getChildren().get(index);
		}
		else {
			TreeModel<T> previousParent = parent.getPreviousSibling();
			return getPreviousSibling(previousParent, (previousParent != null ? previousParent.getChildCount() : 0) - 1);
		}
	} 
                            #location 10 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             private TreeModel<T> getPreviousSibling(TreeModel<T> parent, int index) {
		if (parent == null) {
			return null;
		}
		else if (index >= 0) {
			return parent.getChildren().get(index);
		}
		else {
			TreeModel<T> previousParent = parent.getPreviousSibling();
			return getPreviousSibling(previousParent, (previousParent != null ? previousParent.getChildCount() : 0) - 1);
		}
	}