Skip to content

Commit 858b366

Browse files
committed
Fix pathological case of empty statement
1 parent 9eb0b8c commit 858b366

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sqlparse/filters.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ def process(self, stack, stmt, depth=0):
271271
[self.process(stack, sgroup, depth + 1)
272272
for sgroup in stmt.get_sublists()]
273273
self._stripws(stmt)
274-
if depth == 0 and stmt.tokens[-1].is_whitespace():
274+
if (
275+
depth == 0
276+
and stmt.tokens
277+
and stmt.tokens[-1].is_whitespace()
278+
):
275279
stmt.tokens.pop(-1)
276280

277281

0 commit comments

Comments
 (0)