Skip to content

Commit

Permalink
Ensure upper bound never exceeds number of lines in file
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Sep 6, 2012
1 parent 81a0f90 commit 0541383
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion raven/utils/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def get_lines_from_file(filename, lineno, context_lines, loader=None, module_nam
source = [unicode(sline, encoding, 'replace') for sline in source]

lower_bound = max(0, lineno - context_lines)
upper_bound = lineno + context_lines
upper_bound = min(lineno + context_lines, len(source))

try:
pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
Expand Down

0 comments on commit 0541383

Please sign in to comment.