From 49a96b8865d9b9377b52a509ab13a8bfd8afff0a Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 21 Jan 2024 01:46:27 -0800 Subject: fixed stuff? idk --- .gitmodules | 2 +- src/builtins.c | 8 ++++---- stemlib | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitmodules b/.gitmodules index 81991dc..cf2ae3c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,4 +3,4 @@ url = https://github.com/jothepro/doxygen-awesome-css.git [submodule "stemlib"] path = stemlib - url = https://github.com/ret2pop/stemlib + url = git@github.com:ret2pop/stemlib diff --git a/src/builtins.c b/src/builtins.c index 475306d..73e16fd 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -1033,7 +1033,7 @@ void vat(value_t *v) { return; } if (v2->type == VQUOTE) { - if (v2->quote->size <= v1->int_float) { + if (v2->quote->size <= v1->int_float || v1->int_float < 0) { array_append(STACK, v1); array_append(STACK, v2); eval_error("INDEX ERROR"); @@ -1043,7 +1043,7 @@ void vat(value_t *v) { array_append(STACK, value_copy(v2->quote->items[(int)v1->int_float])); value_free(v1); } else if (v2->type == VSTR || v2->type == VWORD) { - if (v2->str_word->length <= v1->int_float) { + if (v2->str_word->length <= v1->int_float || v1->int_float < 0) { array_append(STACK, v1); array_append(STACK, v2); eval_error("INDEX ERROR"); @@ -1131,7 +1131,7 @@ void stemcut(value_t *v) { switch (v2->type) { case VWORD: case VSTR: - if (v1->int_float >= v2->str_word->length) { + if (v1->int_float >= v2->str_word->length || v1->int_float < 0) { array_append(STACK, v1); array_append(STACK, v2); eval_error("INDEX ERROR"); @@ -1154,7 +1154,7 @@ void stemcut(value_t *v) { } break; case VQUOTE: - if (v1->int_float >= v2->quote->size) { + if (v1->int_float >= v2->quote->size || v1->int_float < 0) { array_append(STACK, v1); array_append(STACK, v2); eval_error("INDEX ERROR"); diff --git a/stemlib b/stemlib index 2c9840a..abb6b28 160000 --- a/stemlib +++ b/stemlib @@ -1 +1 @@ -Subproject commit 2c9840a0a469a3ddd223a060e276c630a493acb6 +Subproject commit abb6b28a6993e47d696b62bf248e4a3507ffa275 -- cgit