tileset_from_json now returns an error if allocation of tileset failed
This commit is contained in:
parent
26808815c8
commit
b442e493d2
|
@ -90,7 +90,7 @@ Tileset* tileset_from_json(cJSON* json) {
|
||||||
ASSERT_RETURN(atlas_surface != NULL, NULL, "Failed to load atlas image while loading tileset");
|
ASSERT_RETURN(atlas_surface != NULL, NULL, "Failed to load atlas image while loading tileset");
|
||||||
|
|
||||||
Tileset* self = malloc(sizeof(Tileset));
|
Tileset* self = malloc(sizeof(Tileset));
|
||||||
if(self != NULL) {
|
if(self == NULL) {
|
||||||
SDL_FreeSurface(atlas_surface);
|
SDL_FreeSurface(atlas_surface);
|
||||||
RETURN_ERROR(NULL, "Failed to allocate space for new tileset.");
|
RETURN_ERROR(NULL, "Failed to allocate space for new tileset.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue