Strange issue with recursion?

So essentially, the following snippet of code loops endlessly.

		while (parent != null) {
			System.out.println(parent);
			offset.add(offsetFromParentWithRotation());
			parent = parent.getParent();
		}

Why is that? Am I not allowed to set the parent like that, or am I missing something very obvious?