aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mac_gl.m3
-rw-r--r--src/win_gl.c3
-rw-r--r--src/x11_gl.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/src/mac_gl.m b/src/mac_gl.m
index dd94e54..25704c3 100644
--- a/src/mac_gl.m
+++ b/src/mac_gl.m
@@ -135,6 +135,9 @@ static PuglStatus
puglMacGlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose))
{
PuglOpenGLView* const drawView = (PuglOpenGLView*)view->impl->drawView;
+ if (!drawView) {
+ return PUGL_FAILURE;
+ }
[[drawView openGLContext] makeCurrentContext];
return PUGL_SUCCESS;
diff --git a/src/win_gl.c b/src/win_gl.c
index 0a035a1..a755020 100644
--- a/src/win_gl.c
+++ b/src/win_gl.c
@@ -258,6 +258,9 @@ static PuglStatus
puglWinGlEnter(PuglView* view, const PuglExposeEvent* expose)
{
PuglWinGlSurface* surface = (PuglWinGlSurface*)view->impl->surface;
+ if (!surface || !surface->hglrc) {
+ return PUGL_FAILURE;
+ }
wglMakeCurrent(view->impl->hdc, surface->hglrc);
diff --git a/src/x11_gl.c b/src/x11_gl.c
index 1ebe829..41007cd 100644
--- a/src/x11_gl.c
+++ b/src/x11_gl.c
@@ -103,6 +103,9 @@ static PuglStatus
puglX11GlEnter(PuglView* view, const PuglExposeEvent* PUGL_UNUSED(expose))
{
PuglX11GlSurface* surface = (PuglX11GlSurface*)view->impl->surface;
+ if (!surface || !surface->ctx) {
+ return PUGL_FAILURE;
+ }
return glXMakeCurrent(view->impl->display, view->impl->win, surface->ctx)
? PUGL_SUCCESS