diff --git a/src/backend/egl/display.rs b/src/backend/egl/display.rs index e416299..aa273b4 100644 --- a/src/backend/egl/display.rs +++ b/src/backend/egl/display.rs @@ -97,8 +97,11 @@ impl> EGLDisplay { |e: &str| dp_extensions.iter().any(|s| s == e), log.clone(), ) - .map_err(Error::DisplayNotSupported)? + .map_err(Error::DisplayCreationError)? }; + if display == ffi::egl::NO_DISPLAY { + return Err(Error::DisplayNotSupported); + } let egl_version = { let mut major: MaybeUninit = MaybeUninit::uninit(); diff --git a/src/backend/egl/error.rs b/src/backend/egl/error.rs index cc4c24d..938fc19 100644 --- a/src/backend/egl/error.rs +++ b/src/backend/egl/error.rs @@ -15,9 +15,12 @@ pub enum Error { /// Backend does not match the context type #[error("The expected backend '{0:?}' does not match the runtime")] NonMatchingBackend(&'static str), + /// Display creation failed + #[error("Display creation failed with error: {0:}")] + DisplayCreationError(#[source] EGLError), /// Unable to obtain a valid EGL Display - #[error("Unable to obtain a valid EGL Display. Err: {0:}")] - DisplayNotSupported(#[source] EGLError), + #[error("Unable to obtain a valid EGL Display.")] + DisplayNotSupported, /// `eglInitialize` returned an error #[error("Failed to initialize EGL. Err: {0:}")] InitFailed(#[source] EGLError),