From bc82ce348a640aa42ae0776e1506df1787211338 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Wed, 3 May 2017 20:35:39 -0400 Subject: [PATCH] Fix regression where math ops didn't error. --- core/parse.c | 9 +++------ core/stl.c | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/parse.c b/core/parse.c index 7ccdaa24..506d150d 100644 --- a/core/parse.c +++ b/core/parse.c @@ -536,15 +536,12 @@ void gst_parser(GstParser *p, Gst *vm) { parser_push(p, PTYPE_ROOT, ' '); } -/* CG finalize a parser */ -static void gst_stl_parser_finalize(Gst *vm, void *data, uint32_t len) { - /* printf("Finalizing parser: %p, %d\n", data, len); */ -} - /* GC mark a parser */ static void gst_stl_parser_mark(Gst *vm, void *data, uint32_t len) { uint32_t i; GstParser *p = (GstParser *) data; + if (len != sizeof(GstParser)) + return; gst_mark_mem(vm, p->data); gst_mark_value(vm, p->value); for (i = 0; i < p->count; ++i) { @@ -572,7 +569,7 @@ static const GstUserType gst_stl_parsetype = { "std.parser", NULL, NULL, - &gst_stl_parser_finalize, + NULL, &gst_stl_parser_mark }; diff --git a/core/stl.c b/core/stl.c index 89e23881..1a242488 100644 --- a/core/stl.c +++ b/core/stl.c @@ -65,6 +65,8 @@ int gst_stl_##name(Gst* vm) {\ rhs = gst_arg(vm, j);\ lhs = gst_stl_binop_##name(lhs, rhs);\ }\ + if (lhs.type == GST_NIL)\ + gst_c_throwc(vm, "expected integer/real");\ gst_c_return(vm, lhs);\ }