From 6a6ca3796f45237843d43805bcbed53a7b19087e Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 25 Mar 2021 18:15:22 -0600 Subject: avoid index errors in take_while1 --- yapymake/makefile/parse_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]): -- cgit v1.2.3