Added get(0) != null to the condition