We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffbf055 commit daa252aCopy full SHA for daa252a
src/backends/win32/backend.zig
@@ -402,11 +402,15 @@ pub fn Events(comptime T: type) type {
402
// For menubar item events, HIWORD(wp) and lp are set to 0.
403
else if (code == 0) {
404
const data = getEventUserData(hwnd);
405
- const window: *Window = @ptrFromInt(data.classUserdata);
+ const window_ptr: ?*Window = @ptrFromInt(data.classUserdata);
406
const id: u16 = @intCast(wp & 0xFFFF);
407
408
- if (window.menu_item_callbacks.items[id]) |callback| {
409
- callback();
+ if (window_ptr) |window| {
+ if (id < window.menu_item_callbacks.items.len) {
410
+ if (window.menu_item_callbacks.items[id]) |callback| {
411
+ callback();
412
+ }
413
414
}
415
416
},
0 commit comments