Protect add-variable-watcher from incorrect usage

* src/data.c (Fadd_variable_watcher): Avoid crashes if SYMBOL
isn't.  (Bug#47462)
This commit is contained in:
Eli Zaretskii 2021-03-29 13:39:43 +03:00
parent afc214f139
commit a1e454d6df

View file

@ -1589,6 +1589,7 @@ All writes to aliases of SYMBOL will call WATCH-FUNCTION too. */)
(Lisp_Object symbol, Lisp_Object watch_function)
{
symbol = Findirect_variable (symbol);
CHECK_SYMBOL (symbol);
set_symbol_trapped_write (symbol, SYMBOL_TRAPPED_WRITE);
map_obarray (Vobarray, harmonize_variable_watchers, symbol);