Add memory allocation checks

Closes #18.
This commit is contained in:
Marc Tiehuis
2017-08-12 11:09:07 +12:00
parent 912afdfe05
commit 984a5b9f18
4 changed files with 14 additions and 3 deletions
+2
View File
@@ -26,6 +26,8 @@ struct gfx_state* gfx_init(struct gamestate *g)
refresh();
struct gfx_state *s = malloc(sizeof(struct gfx_state));
if (!s) return NULL;
s->window_height = g->opts->grid_height * (g->print_width + 2) + 3;
s->window_width = g->opts->grid_width * (g->print_width + 2) + 1;
s->window = newwin(s->window_height, s->window_width, 1, 1);