summaryrefslogtreecommitdiff
path: root/src/Fl_Cairo.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-11 12:09:41 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2026-01-11 12:09:41 +0100
commit7b6a779fd3a911c25edf58efc36862c07202a5fa (patch)
tree8d419b95e6ef083e21777c124ea5d4f9a06399e1 /src/Fl_Cairo.cxx
parente59a5dc8044deaa71b089e040fde536310073cfd (diff)
Fix "Wayland: NULL pointer dereference in Fl::cairo_make_current()" (#1359)
Diffstat (limited to 'src/Fl_Cairo.cxx')
-rw-r--r--src/Fl_Cairo.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Fl_Cairo.cxx b/src/Fl_Cairo.cxx
index c69af2c55..a5b471392 100644
--- a/src/Fl_Cairo.cxx
+++ b/src/Fl_Cairo.cxx
@@ -150,8 +150,8 @@ cairo_t *Fl::cairo_make_current(Fl_Window *wi) {
#if defined(FLTK_USE_WAYLAND)
if (fl_wl_display()) { // true means using wayland backend
struct wld_window *xid = fl_wl_xid(wi);
- if (!xid->buffer)
- return NULL; // this may happen with GL windows
+ if (!xid || !xid->buffer)
+ return NULL; // this may happen with GL windows or if window is not shown
cairo_ctxt = xid->buffer->draw_buffer.cairo_;
Fl::Private::cairo_state_.cc(cairo_ctxt, false);
return cairo_ctxt;