mirror of
https://github.com/neovim/neovim.git
synced 2025-09-19 17:58:18 +00:00
eval: Make sure that v:_null_dict does not crash dictwatcher*()
Ref #4615
This commit is contained in:
@@ -808,6 +808,9 @@ void tv_dict_watcher_add(dict_T *const dict, const char *const key_pattern,
|
||||
const size_t key_pattern_len, Callback callback)
|
||||
FUNC_ATTR_NONNULL_ARG(2)
|
||||
{
|
||||
if (dict == NULL) {
|
||||
return;
|
||||
}
|
||||
DictWatcher *const watcher = xmalloc(sizeof(DictWatcher));
|
||||
watcher->key_pattern = xmemdupz(key_pattern, key_pattern_len);
|
||||
watcher->key_pattern_len = key_pattern_len;
|
||||
|
Reference in New Issue
Block a user