Move allocation failure check closer to allocation
This commit is contained in:
parent
40b4fb966f
commit
2d06ee5822
@ -1260,7 +1260,6 @@ send_prerendered_sprites_for_window(OSWindow *w) {
|
||||
FontGroup *fg = (FontGroup*)w->fonts_data;
|
||||
if (!fg->sprite_map) {
|
||||
fg->sprite_map = alloc_sprite_map(fg->cell_width, fg->cell_height);
|
||||
if (!fg->sprite_map) fatal("Out of memory allocating a sprite map");
|
||||
send_prerendered_sprites(fg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,12 +37,11 @@ alloc_sprite_map(unsigned int cell_width, unsigned int cell_height) {
|
||||
sprite_tracker_set_limits(max_texture_size, max_array_texture_layers);
|
||||
}
|
||||
SpriteMap *ans = calloc(1, sizeof(SpriteMap));
|
||||
if (ans) {
|
||||
if (!ans) fatal("Out of memory allocating a sprite map");
|
||||
*ans = NEW_SPRITE_MAP;
|
||||
ans->max_texture_size = max_texture_size;
|
||||
ans->max_array_texture_layers = max_array_texture_layers;
|
||||
ans->cell_width = cell_width; ans->cell_height = cell_height;
|
||||
}
|
||||
return (SPRITE_MAP_HANDLE)ans;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user