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
I don't think this is an improvement - it avoids the (handled) IndexError, but it has more complicated code.  Was there a bug in the previous code that's not obvious to me?