diff options
author | Melody Horn <melody@boringcactus.com> | 2021-03-25 18:15:22 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-03-25 18:15:22 -0600 |
commit | 6a6ca3796f45237843d43805bcbed53a7b19087e (patch) | |
tree | 3d97d1a3fd96aee939591de4b4052d6233e73f81 | |
parent | c31ba8abee7a9f836d32e231d772ea807cf87714 (diff) | |
download | yapymake-6a6ca3796f45237843d43805bcbed53a7b19087e.tar.gz yapymake-6a6ca3796f45237843d43805bcbed53a7b19087e.zip |
avoid index errors in take_while1
-rw-r--r-- | yapymake/makefile/parse_util.py | 2 |
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]): |