mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-10-21 04:32:05 +00:00
Window for id should not fail when not called from a callback
This commit is contained in:
parent
13cf38d6c6
commit
e1f3cb85c0
1 changed files with 7 additions and 5 deletions
|
|
@ -143,12 +143,14 @@ encode_mouse_scroll(Window *w, int button, int mods) {
|
|||
|
||||
static Window*
|
||||
window_for_id(id_type window_id) {
|
||||
Tab *t = global_state.callback_os_window->tabs + global_state.callback_os_window->active_tab;
|
||||
for (unsigned int i = 0; i < t->num_windows; i++) {
|
||||
Window *w = t->windows + i;
|
||||
if (w->id == window_id) return w;
|
||||
if (global_state.callback_os_window && global_state.callback_os_window->tabs) {
|
||||
Tab *t = global_state.callback_os_window->tabs + global_state.callback_os_window->active_tab;
|
||||
for (unsigned int i = 0; i < t->num_windows; i++) {
|
||||
Window *w = t->windows + i;
|
||||
if (w->id == window_id) return w;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return window_for_window_id(window_id);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue