summaryrefslogtreecommitdiffstats
path: root/libnetdata/json
diff options
context:
space:
mode:
Diffstat (limited to 'libnetdata/json')
-rw-r--r--libnetdata/json/jsmn.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libnetdata/json/jsmn.c b/libnetdata/json/jsmn.c
index c8d9e73d..95253589 100644
--- a/libnetdata/json/jsmn.c
+++ b/libnetdata/json/jsmn.c
@@ -301,10 +301,12 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
}
}
- for (i = parser->toknext - 1; i >= 0; i--) {
- /* Unmatched opened object or array */
- if (tokens[i].start != -1 && tokens[i].end == -1) {
- return JSMN_ERROR_PART;
+ if (tokens) {
+ for (i = parser->toknext - 1; i >= 0; i--) {
+ /* Unmatched opened object or array */
+ if (tokens[i].start != -1 && tokens[i].end == -1) {
+ return JSMN_ERROR_PART;
+ }
}
}