tileset_from_json now returns an error if allocation of tileset failed

This commit is contained in:
Sara 2023-10-06 23:42:38 +02:00
parent 26808815c8
commit b442e493d2

View file

@ -90,7 +90,7 @@ Tileset* tileset_from_json(cJSON* json) {
ASSERT_RETURN(atlas_surface != NULL, NULL, "Failed to load atlas image while loading tileset");
Tileset* self = malloc(sizeof(Tileset));
if(self != NULL) {
if(self == NULL) {
SDL_FreeSurface(atlas_surface);
RETURN_ERROR(NULL, "Failed to allocate space for new tileset.");
}