Fix crash when deleting the last item from the adapter.

Addresses the 2nd half of #2