1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 10:17:15 +03:00

Handle empty case

This commit is contained in:
Darik Gamble 2016-10-17 13:52:07 -04:00
parent 0881902207
commit d82591f7b7

View File

@ -456,7 +456,10 @@ def suggest_based_on_last_token(token, stmt):
# token is a keyword we haven't implemented any special handling for
# go backwards in the query until we find one we do recognize
prev_keyword = stmt.reduce_to_prev_keyword(n_skip=1)
return suggest_based_on_last_token(prev_keyword, stmt)
if prev_keyword:
return suggest_based_on_last_token(prev_keyword, stmt)
else:
return (Keyword(),)
else:
return (Keyword(),)