From 03328ac10ffee251bb97fb258ae66a046f19eea6 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 3 Dec 2025 20:44:01 -0600 Subject: [PATCH] [turbine/glfw] Fix to handle null click handler --- src/olympic/turbine/src/glfw/turbine.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/olympic/turbine/src/glfw/turbine.cpp b/src/olympic/turbine/src/glfw/turbine.cpp index 6efb6dd6..cc4b1bad 100644 --- a/src/olympic/turbine/src/glfw/turbine.cpp +++ b/src/olympic/turbine/src/glfw/turbine.cpp @@ -285,11 +285,11 @@ static void handleKeyPress(Context &ctx, int const key, bool const down) noexcep map[GLFW_KEY_ESCAPE] = Key::Escape; return map; }(); - auto const eventHandler = keyEventHandler(ctx); auto const keyIdx = static_cast(key); if (keyIdx < keyMap.size()) { auto const k = keyMap[keyIdx]; setKeyDownStatus(ctx, k, down); + auto const eventHandler = keyEventHandler(ctx); if (eventHandler) { eventHandler(ctx, k, down); } @@ -306,7 +306,9 @@ static void handleGlfwMouseButtonEvent( int) noexcept { auto &ctx = *static_cast(glfwGetWindowUserPointer(window)); setMandatoryRefreshPeriod(ctx, ticksMs(ctx) + config::MandatoryRefreshPeriod); - ctx.mouseButtonEventHandler(ctx, btn, action == 1); + if (ctx.mouseButtonEventHandler) { + ctx.mouseButtonEventHandler(ctx, btn, action == 1); + } } static void handleGlfwKeyEvent(GLFWwindow *window, int const key, int, int const action, int) noexcept {