Fixed test for null

The input parameter must checked for null. Otherwise the next condition might fail with an NullPointerException.