Skip to content

Commit

Permalink
check if array is present before attempting to retrieve item
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-satish committed Jun 2, 2015
1 parent 4fecc1f commit ef19c99
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions coaster/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,8 @@ def for_tsquery(text):
counter -= 1
counterlength -= 1
counter += 1
if tokens:
while tokens[0] in ('&', '|', ':*', ')'):
tokens.pop(0) # Can't start with a binary or suffix operator
while tokens and tokens[0] in ('&', '|', ':*', ')', '!'):
tokens.pop(0) # Can't start with a binary or suffix operator
if tokens:
while tokens[-1] in ('&', '|', '!', '('):
tokens.pop(-1) # Can't end with a binary or prefix operator
Expand Down

0 comments on commit ef19c99

Please sign in to comment.