Skip to content

Commit a747334

Browse files
committed
Make sure to check action x y before use
Fixes #84
1 parent 47fe94a commit a747334

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ build
88
.cproject
99
builtins
1010
.internal
11+
/.editor_settings

gooey/internal/core.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local EMPTY = hash("")
77
local long_press_start = 0
88

99
local function handle_action(component, action_id, action)
10+
if not action.x or not action.y then return end
1011
action.id = action.id or -1
1112
component.long_pressed_time = component.long_pressed_time or 1.5
1213
if not component.touch_id or component.touch_id == action.id then

gooey/internal/list.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ end
121121

122122

123123
local function handle_input(list, action_id, action, click_fn)
124+
if not action.x or not action.y then return end
124125
local over_stencil = gui.pick_node(list.stencil, action.x, action.y)
125126
list.over = over_stencil
126127

gooey/internal/scrollbar.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function M.vertical(handle_id, bounds_id, action_id, action, fn, refresh_fn)
6262
scrollbar.bounds_size = bounds_size
6363
scrollbar.handle_size = handle_size
6464

65-
if action then
65+
if action and action.x and action.y then
6666
local action_pos = vmath.vector3(action.x, action.y, 0)
6767

6868
core.clickable(scrollbar, action_id, action)
@@ -104,7 +104,7 @@ function M.horizontal(handle_id, bounds_id, action_id, action, fn, refresh_fn)
104104
scrollbar.bounds_size = bounds_size
105105
scrollbar.handle_size = handle_size
106106

107-
if action then
107+
if action and action.x and action.y then
108108
local action_pos = vmath.vector3(action.x, action.y, 0)
109109

110110
core.clickable(scrollbar, action_id, action)

0 commit comments

Comments
 (0)