Avoid undefined behavior with botched pgtk menu

* src/pgtkmenu.c (pgtk_menu_show): Do not dereference save_wv if
null.  Problem found by gcc 20250110 (Red Hat 14.2.1-7)
-Wanalyzer-null-dereference.
This commit is contained in:
Paul Eggert 2025-01-26 22:15:49 -08:00
parent 06fd3f4e98
commit c0d83876f1

View file

@ -725,7 +725,7 @@ pgtk_menu_show (struct frame *f, int x, int y, int menuflags,
STRINGP (help) ? help : Qnil);
if (prev_wv)
prev_wv->next = wv;
else
else if (save_wv)
save_wv->contents = wv;
if (!NILP (descrip))
wv->key = SSDATA (descrip);