From ae7a532d068633e4043351f625a7500afb959298 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Thu, 10 Nov 2022 14:19:23 +0000 Subject: [PATCH] do not create a surface if the window provided is invalid --- src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs b/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs index a6d8c1e98d..04ea29a507 100644 --- a/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs +++ b/src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs @@ -50,6 +50,8 @@ namespace Avalonia.OpenGL.Egl { using (PrimaryContext.MakeCurrent()) { + if(window == IntPtr.Zero) + throw new OpenGlException($"Window {window} is invalid."); var s = Display.EglInterface.CreateWindowSurface(Display.Handle, Display.Config, window, new[] { EGL_NONE, EGL_NONE }); if (s == IntPtr.Zero)