Skip to content

Commit 4dd319c

Browse files
author
Dan Walmsley
authored
Merge pull request #9408 from AvaloniaUI/surface
Do not create an egl surface if the window provided is invalid
2 parents dd2115c + 3ed4137 commit 4dd319c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Avalonia.OpenGL/Egl/EglPlatformOpenGlInterface.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ public static EglPlatformOpenGlInterface TryCreate(Func<EglDisplay> displayFacto
4444

4545
public IGlContext CreateContext() => Display.CreateContext(null);
4646
public IGlContext CreateSharedContext() => Display.CreateContext(PrimaryEglContext);
47-
47+
4848

4949
public EglSurface CreateWindowSurface(IntPtr window)
5050
{
51+
if (window == IntPtr.Zero)
52+
throw new OpenGlException($"Window {window} is invalid.");
53+
5154
using (PrimaryContext.MakeCurrent())
5255
{
5356
var s = Display.EglInterface.CreateWindowSurface(Display.Handle, Display.Config, window,

0 commit comments

Comments
 (0)