Fix exception on empties

Starting with a fresh database either sqlResults is empty (IndexError) and/or last_proper_search is None (TypeError)
Merge pull request #547 from itofzo/fix_exception_on_empties_tpb

ProperSearch: Fix exception on empties
Merge remote-tracking branch 'upstream/Pistachitos' into Pistachitos