Commit 0c6c64c0 authored by Stefan Behnel's avatar Stefan Behnel

Fix corner case of empty input in tree fragment processing: min() fails on empty sequence.

parent c965cd77
...@@ -209,6 +209,7 @@ def strip_common_indent(lines): ...@@ -209,6 +209,7 @@ def strip_common_indent(lines):
"""Strips empty lines and common indentation from the list of strings given in lines""" """Strips empty lines and common indentation from the list of strings given in lines"""
# TODO: Facilitate textwrap.indent instead # TODO: Facilitate textwrap.indent instead
lines = [x for x in lines if x.strip() != u""] lines = [x for x in lines if x.strip() != u""]
if lines:
minindent = min([len(_match_indent(x).group(0)) for x in lines]) minindent = min([len(_match_indent(x).group(0)) for x in lines])
lines = [x[minindent:] for x in lines] lines = [x[minindent:] for x in lines]
return lines return lines
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment