Make list.last work with empty lists

If last is used on an empty list, it would throw an exception - now just
returns null.