0
0
mirror of https://github.com/vim/vim.git synced 2025-10-28 09:27:14 -04:00

patch 8.1.1452: line and col property of popup windows not properly checked

Problem:    Line and col property of popup windows not properly checked.
Solution:   Check for "+" or "-" sign.
This commit is contained in:
Bram Moolenaar
2019-06-02 16:51:21 +02:00
parent ca2f7037c1
commit b0ebbda06c
6 changed files with 133 additions and 4 deletions

View File

@@ -604,6 +604,27 @@ dict_get_number(dict_T *d, char_u *key)
return tv_get_number(&di->di_tv);
}
/*
* Get a number item from a dictionary.
* Returns 0 if the entry doesn't exist.
* Give an error if the entry is not a number.
*/
varnumber_T
dict_get_number_check(dict_T *d, char_u *key)
{
dictitem_T *di;
di = dict_find(d, key, -1);
if (di == NULL)
return 0;
if (di->di_tv.v_type != VAR_NUMBER)
{
semsg(_(e_invarg2), tv_get_string(&di->di_tv));
return 0;
}
return tv_get_number(&di->di_tv);
}
/*
* Return an allocated string with the string representation of a Dictionary.
* May return NULL.