diff --git a/libs/collections/list.c b/libs/collections/list.c index 72fcb50..126dc11 100644 --- a/libs/collections/list.c +++ b/libs/collections/list.c @@ -372,6 +372,9 @@ GroundValue reverseListStruct(GroundScope* scope, List args) { GroundValue* items = (GroundValue*)ptrField->value.data.intVal; GroundValue* newBuffer = calloc(capacity, sizeof(GroundValue)); + if (newBuffer == NULL) { + ERROR("Failed to allocate memory when reversing list!", "MemoryAllocationFailed"); + } int z = 0; for (int i = size - 1; i >= 0; i--, z++) {