Check items.size() to avoid NPE, not whether items.get(0) != null.

The previous code didn't actually avoid the NPE.