diff options
| author | chenzizhan <[email protected]> | 2023-10-16 15:29:43 +0800 |
|---|---|---|
| committer | chenzizhan <[email protected]> | 2023-10-16 15:29:43 +0800 |
| commit | d45698e32ee38b6bba494bd5b4bacc5733a7ae27 (patch) | |
| tree | c85d53d4c2955f4a912c534d3dbf8884aa46fe3b /src/exporter | |
| parent | 77a8579f56af2cb64ac66d421980e90a2e045ff2 (diff) | |
assert NULL when query
Diffstat (limited to 'src/exporter')
| -rw-r--r-- | src/exporter/cjson_exporter.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/exporter/cjson_exporter.c b/src/exporter/cjson_exporter.c index 86399fa..bfd2bdc 100644 --- a/src/exporter/cjson_exporter.c +++ b/src/exporter/cjson_exporter.c @@ -775,6 +775,11 @@ int add_object_to_json_array(char **buf, int *buf_len, int start, const char *st */ void fieldstat_json_exporter_export_array(const struct fieldstat_json_exporter *exporter, const struct fieldstat *instance, const struct timeval *timestamp, char ***output, size_t *output_size) { + if (instance == NULL) { + *output = NULL; + *output_size = 0; + return; + } long long timestamp_ms = cal_ms_time(timestamp); if (exporter->history != NULL) { fieldstat_json_exporter_update_history((struct fieldstat_json_exporter *)exporter, instance); |
