From c96b292a824e81a7d9af266ae18a0ed304be343f Mon Sep 17 00:00:00 2001 From: "A. R. Shajii" Date: Tue, 4 Jul 2023 23:52:10 -0400 Subject: [PATCH] Fix str.zfill() on empty string --- stdlib/internal/str.codon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/internal/str.codon b/stdlib/internal/str.codon index d10146b7..274da890 100644 --- a/stdlib/internal/str.codon +++ b/stdlib/internal/str.codon @@ -591,7 +591,7 @@ class str: fill = width - len(self) p = zf.ptr - if p[fill] == plus or p[fill] == minus: + if len(self) > 0 and p[fill] == plus or p[fill] == minus: p[0] = p[fill] p[fill] = zero