aboutsummaryrefslogtreecommitdiff
path: root/examples/touch.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-08-15 12:21:58 -0400
committerGitHub <noreply@github.com>2017-08-15 12:21:58 -0400
commit27c13d621df7b38d04f8ffb3012aa977d1b9bb24 (patch)
tree4cf9539672adb77ddc6ac2110a6f4458b386e9a1 /examples/touch.c
parentf60b53c6e3c91aefa432ce75deb89560a8e5c0d7 (diff)
parent5cc7342606dbbd5e6932b39e6b1b5645164669bf (diff)
Merge pull request #88 from 4e554c4c/alloc_crashing
Prevent alloc errors from crashing
Diffstat (limited to 'examples/touch.c')
-rw-r--r--examples/touch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/touch.c b/examples/touch.c
index 9dd2fe57..a32c76ba 100644
--- a/examples/touch.c
+++ b/examples/touch.c
@@ -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);