Prevent alloc errors from crashing

Resolves #76
This commit is contained in:
Calvin Lee 2017-08-15 07:56:47 +02:00
parent 5ca88af557
commit 5cc7342606
13 changed files with 109 additions and 13 deletions

View file

@ -17,6 +17,7 @@
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/util/list.h>
#include <wlr/util/log.h>
#include "shared.h"
#include "cat.h"
@ -105,7 +106,15 @@ int main(int argc, char *argv[]) {
compositor_init(&compositor);
state.renderer = wlr_gles2_renderer_init(compositor.backend);
if (!state.renderer) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
state.cat_texture = wlr_render_texture_init(state.renderer);
if (!state.cat_texture) {
wlr_log(L_ERROR, "Could not start compositor, OOM");
exit(EXIT_FAILURE);
}
wlr_texture_upload_pixels(state.cat_texture, WL_SHM_FORMAT_ARGB8888,
cat_tex.width, cat_tex.width, cat_tex.height, cat_tex.pixel_data);