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.");
     }