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 {