Skip to content

Commit

Permalink
parse error return null
Browse files Browse the repository at this point in the history
  • Loading branch information
yksten committed Dec 23, 2022
1 parent 56d0169 commit e21dc31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/struct2x/json/genericreader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace custom {


struct GenericValue {
enum { VALUE_NULL = 0, VALUE_BOOL, VALUE_NUMBER, VALUE_STRING, VALUE_ARRAY, VALUE_OBJECT };
enum { VALUE_NULL = 0, VALUE_BOOL = 1, VALUE_NUMBER = 2, VALUE_STRING = 3, VALUE_ARRAY = 4, VALUE_OBJECT = 5 };

int32_t type;

Expand Down
6 changes: 5 additions & 1 deletion src/thirdParty/json/genericreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ namespace custom {
if (is.Peek() != '\0') {
ParseValue(is);
}
if (!_strError.empty()) {
return NULL;
}
return root;
}

Expand All @@ -153,8 +156,9 @@ namespace custom {
ParseNumber(is);
break;
}
if (_strError[0])
if (!_strError.empty()) {
return;
}
}

void GenericReader::ParseKey(StringStream& is) {
Expand Down

0 comments on commit e21dc31

Please sign in to comment.