aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-03-25 18:15:22 -0600
committerMelody Horn <melody@boringcactus.com>2021-03-25 18:15:22 -0600
commit6a6ca3796f45237843d43805bcbed53a7b19087e (patch)
tree3d97d1a3fd96aee939591de4b4052d6233e73f81
parentc31ba8abee7a9f836d32e231d772ea807cf87714 (diff)
downloadyapymake-6a6ca3796f45237843d43805bcbed53a7b19087e.tar.gz
yapymake-6a6ca3796f45237843d43805bcbed53a7b19087e.zip
avoid index errors in take_while1
-rw-r--r--yapymake/makefile/parse_util.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/yapymake/makefile/parse_util.py b/yapymake/makefile/parse_util.py
index f31e970..ad1e363 100644
--- a/yapymake/makefile/parse_util.py
+++ b/yapymake/makefile/parse_util.py
@@ -47,7 +47,7 @@ def tag(tag_text: str) -> Parser[None]:
def take_while1(predicate: Callable[[str], bool]) -> Parser[str]:
def parse(text: str) -> ParseResult[str]:
- if not predicate(text[0]):
+ if len(text) == 0 or not predicate(text[0]):
return None
for i in range(1, len(text)):
if not predicate(text[i]):