handle some more memory allocation errors

This commit is contained in:
2026-04-12 07:50:03 +10:00
parent 3427df2643
commit c64c590abb

View File

@@ -372,6 +372,9 @@ GroundValue reverseListStruct(GroundScope* scope, List args) {
GroundValue* items = (GroundValue*)ptrField->value.data.intVal; GroundValue* items = (GroundValue*)ptrField->value.data.intVal;
GroundValue* newBuffer = calloc(capacity, sizeof(GroundValue)); GroundValue* newBuffer = calloc(capacity, sizeof(GroundValue));
if (newBuffer == NULL) {
ERROR("Failed to allocate memory when reversing list!", "MemoryAllocationFailed");
}
int z = 0; int z = 0;
for (int i = size - 1; i >= 0; i--, z++) { for (int i = size - 1; i >= 0; i--, z++) {