The PSIElement.getParent method Javadoc says:
* Returns the parent of the PSI element.
* @return the parent of the element, or null if the element has no parent.
How is it possible for an element inside a file to have no parent? Even the toplevel PSI element in the file has the file itself set as the parent.