added error when failing to expand world

pull/12/head
Sara 2023-07-12 02:16:05 +02:00
parent e6b66884ec
commit 544f18e9c6
1 changed files with 1 additions and 0 deletions

View File

@ -16,6 +16,7 @@ int _expand_world() {
size_t new_num = _world_objects.num * 2; size_t new_num = _world_objects.num * 2;
object_t** new_list = realloc(_world_objects.objects, new_num * sizeof(object_t*)); object_t** new_list = realloc(_world_objects.objects, new_num * sizeof(object_t*));
if(new_list == NULL) { if(new_list == NULL) {
printf("ERROR: failed to expand world when requesting additional objects\n");
return 0; return 0;
} else { } else {
_world_objects.objects = new_list; _world_objects.objects = new_list;