The default Point2D value for a null container in the Comparator is Double.MIN_VALUE. This results in non-null containers getting pushed down in the array. For the case of a single container in an array, that means:
Because of the center(IAtomContainer container) method, the return is -1. Hence, the non-null container that used to be at index 0 in the array is resorted to the last position of the array. Consequently trying to get the container at position 0 somewhere later in the code fails.
The patch inverts that behavior by ensuring that null always ends up higher in the array than non-null container.