Potential for NullPointerException here.  Should check for null first, then the isEmpty.