Move nullpointer check for better coverage.