Fixed potential problem with IndexError in QuerySet.first()

The current implementation may suppress internal IndexError exceptions.

Please see ticket 23555 for more details. https://code.djangoproject.com/ticket/23555#ticket
`grep -rI "first()" *` in the tests directory yields results. I think `get_earliest_or_latest`is the main place it's tested.