Don’t use garbage after tty_frame_at returns nil

* src/term.c (handle_one_term_event): Don’t access possibly
uninitialized storage if frame is nil.  This fixes an issue introduced
in commit 5eae7f5227 dated 2025-01-26
14:43:51 -0800. Issue caught by --enable-gcc-warnings, which enables
-Wanalyzer-use-of-uninitialized-value with gcc (GCC) 14.2.1 20250110
(Red Hat 14.2.1-7).
This commit is contained in:
Paul Eggert 2025-01-31 14:42:33 -08:00
parent e8ae77e939
commit 3a7809f9cc

View file

@ -2767,8 +2767,8 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
int
handle_one_term_event (struct tty_display_info *tty, const Gpm_Event *event_in)
{
int child_x, child_y;
Lisp_Object frame = tty_frame_at (event_in->x, event_in->y, &child_x, &child_y);
int child_x = event_in->x, child_y = event_in->y;
Lisp_Object frame = tty_frame_at (child_x, child_y, &child_x, &child_y);
Gpm_Event event = *event_in;
event.x = child_x;
event.y = child_y;