From cbf07d3190b8ce07b3f6ec08335677240779218e Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 7 Aug 2014 18:05:18 +0200 Subject: [PATCH] Add some error detection --- src/x11/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/x11/mod.rs b/src/x11/mod.rs index 9103ea21..4088f29f 100644 --- a/src/x11/mod.rs +++ b/src/x11/mod.rs @@ -144,7 +144,13 @@ impl Window { // creating the dummy context let dummy_context = ffi::glXCreateContext(display, &visual_infos, ptr::null(), 1); - ffi::glXMakeCurrent(display, window, dummy_context); + if dummy_context.is_null() { + return Err(format!("glXCreateContext failed")); + } + + if ffi::glXMakeCurrent(display, window, dummy_context) == 0 { + return Err(format!("glXMakeCurrent with dummy context failed")); + } // getting the pointer let fn_ptr = {