From b442e493d2b6e18ded3f5df378428d7373ba23e8 Mon Sep 17 00:00:00 2001 From: Sara Date: Fri, 6 Oct 2023 23:42:38 +0200 Subject: [PATCH] tileset_from_json now returns an error if allocation of tileset failed --- src/tileset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tileset.c b/src/tileset.c index 1e68a89..0233aef 100644 --- a/src/tileset.c +++ b/src/tileset.c @@ -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."); }