Mercurial > vim
diff src/dict.c @ 16902:23645f9a5ce2 v8.1.1452
patch 8.1.1452: line and col property of popup windows not properly checked
commit https://github.com/vim/vim/commit/b0ebbda06cf1a4a7c40cb274529c4c53de534e32
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 2 16:51:21 2019 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Jun 2019 17:00:05 +0200 |
parents | ce04ebdf26b8 |
children | efc6f5e3b543 |
line wrap: on
line diff
--- a/src/dict.c +++ b/src/dict.c @@ -605,6 +605,27 @@ dict_get_number(dict_T *d, char_u *key) } /* + * 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. */