Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zenroom
Zenroom
Commits
bff65940
Commit
bff65940
authored
May 20, 2022
by
Jaromil
Browse files
fix trimming json on parse
parent
a56ad1ed
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/zen_parse.c
View file @
bff65940
...
...
@@ -134,11 +134,12 @@ static int lua_unserialize_json(lua_State* L) {
in
=
luaL_checklstring
(
L
,
1
,
&
size
);
p
=
(
char
*
)
in
;
while
(
size
&&
isspace
(
*
p
)
)
{
size
--
;
p
++
;
}
// first char
while
(
size
&&
(
*
p
==
0x0
)
)
{
size
--
;
p
++
;
}
// first char
if
(
!
size
)
{
lua_pushnil
(
L
);
return
1
;
}
if
(
*
p
==
'{'
||
*
p
==
'['
)
{
level
++
;
}
else
{
func
(
L
,
"JSON doesn't starts with '{', char found: %c
"
,
*
p
);
func
(
L
,
"JSON doesn't starts with '{', char found: %c
(%02x)"
,
*
p
,
*
p
);
lua_pushnil
(
L
);
return
1
;
}
// ok, level is 1
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment