core: fix NULL-dereference of file_watch_handle

It's not initialized if there is no config file to watch.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-25 09:15:09 +01:00
parent 9a83982d7e
commit 254eab059f
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
1 changed files with 4 additions and 2 deletions

View File

@ -2526,8 +2526,10 @@ static void session_destroy(session_t *ps) {
command_builder_free(ps->command_builder);
ps->command_builder = NULL;
file_watch_destroy(ps->loop, ps->file_watch_handle);
ps->file_watch_handle = NULL;
if (ps->file_watch_handle) {
file_watch_destroy(ps->loop, ps->file_watch_handle);
ps->file_watch_handle = NULL;
}
// Stop listening to events on root window
xcb_change_window_attributes(ps->c.c, ps->c.screen_info->root, XCB_CW_EVENT_MASK,