You have to check that otherNode is a ProjectFile before doing the custom comparison, and return DefaultSort if it isn't.