summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2014-12-13 19:08:06 -0800
committerIan Lee <IanLee1521@gmail.com>2014-12-13 19:20:24 -0800
commite585618c224568c2f47d99ab615b32e5f821a633 (patch)
tree2305a0393c09286e1b7c38943d099eace32312bb /pep8.py
parent60ad926de0a3fdf1be534958d98debc88bc412f5 (diff)
downloadpep8-e585618c224568c2f47d99ab615b32e5f821a633.tar.gz
Don't crash if build_tokens_line() returns None; issue #306
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/pep8.py b/pep8.py
index d638388..0fbe22d 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1346,6 +1346,10 @@ class Checker(object):
"""Build a line from tokens and run all logical checks on it."""
self.report.increment_logical_line()
mapping = self.build_tokens_line()
+
+ if not mapping:
+ return
+
(start_row, start_col) = mapping[0][1]
start_line = self.lines[start_row - 1]
self.indent_level = expand_indent(start_line[:start_col])