From 77d443c53db1c934ecd536df32edf1f9aec90c8d Mon Sep 17 00:00:00 2001 From: takase1121 <20792268+takase1121@users.noreply.github.com> Date: Thu, 4 Jul 2024 22:24:14 +0800 Subject: [PATCH] api/system: check if a window is created when firing DND events --- src/api/system.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/system.c b/src/api/system.c index f301dba5..f3af9570 100644 --- a/src/api/system.c +++ b/src/api/system.c @@ -228,8 +228,9 @@ top: SDL_GetMouseState(&mx, &my); lua_pushstring(L, "filedropped"); lua_pushstring(L, e.drop.file); - lua_pushinteger(L, mx * window_renderer->scale_x); - lua_pushinteger(L, my * window_renderer->scale_y); + // a DND into dock event fired before a window is created + lua_pushinteger(L, mx * (window_renderer ? window_renderer->scale_x : 0)); + lua_pushinteger(L, my * (window_renderer ? window_renderer->scale_y : 0)); SDL_free(e.drop.file); return 4; }