mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-06 01:41:37 +08:00
Check for empty string in js_isarrayindex.
This commit is contained in:
4
jsrun.c
4
jsrun.c
@@ -445,6 +445,10 @@ int js_isarrayindex(js_State *J, const char *p, int *idx)
|
|||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
/* check for empty string */
|
||||||
|
if (p[0] == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
/* check for '0' and integers with leading zero */
|
/* check for '0' and integers with leading zero */
|
||||||
if (p[0] == '0')
|
if (p[0] == '0')
|
||||||
return (p[1] == 0) ? *idx = 0, 1 : 0;
|
return (p[1] == 0) ? *idx = 0, 1 : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user