From 7caa7dceb56452982e753dcba8525289fb5276ec Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 30 May 2021 02:46:49 +0300 Subject: [PATCH] =?UTF-8?q?properly=20fall=20back=20to=20runtime=20in=20na?= =?UTF-8?q?tive=20=E2=8A=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sfns.c | 2 +- src/core/harr.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/builtins/sfns.c b/src/builtins/sfns.c index 8f222700..be557761 100644 --- a/src/builtins/sfns.c +++ b/src/builtins/sfns.c @@ -146,7 +146,7 @@ B select_c2(B t, B w, B x) { BS2B wgetU = TI(w).getU; for (; i < wia; i++) { B cw = wgetU(w, i); - if (!isNum(cw)) { harr_pfree(r.b, i); goto base; } + if (!isNum(cw)) { harr_abandon(r); goto base; } usz c = WRAP(o2i64(cw), xia, thrF("โŠ: Indexing out-of-bounds (%RโˆŠ๐•จ, %sโ‰กโ‰ ๐•ฉ)", cw, xia)); r.a[i] = xget(x, c); } diff --git a/src/core/harr.h b/src/core/harr.h index 753a2a89..dfaad060 100644 --- a/src/core/harr.h +++ b/src/core/harr.h @@ -55,6 +55,10 @@ static usz* harr_fa(HArr_p p, ur r) { VTY(p.b, t_harrPartial); gsPop(); return arr_shAllocR(p.b, r); } +static void harr_abandon(HArr_p p) { VTY(p.b, t_harrPartial); + gsPop(); + value_free((Value*)p.c); +} static HArr_p m_harrUv(usz ia) { B r = m_arr(fsizeof(HArr,a,B,ia), t_harr);