From ca24bd9edfe144da4916a225813861a00c14a403 Mon Sep 17 00:00:00 2001 From: lixinguo Date: Tue, 29 Oct 2024 01:21:52 +0800 Subject: [PATCH] fix: parse fail in empty json Signed-off-by: lixinguo --- internal/core/src/common/Json.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/core/src/common/Json.h b/internal/core/src/common/Json.h index 297dbcbdcca77..0570bdb56dd2c 100644 --- a/internal/core/src/common/Json.h +++ b/internal/core/src/common/Json.h @@ -133,6 +133,9 @@ class Json { value_result doc() const { + if (data_.size() == 0) { + return {}; + } thread_local simdjson::ondemand::parser parser; // it's always safe to add the padding, @@ -148,6 +151,9 @@ class Json { value_result dom_doc() const { + if (data_.size() == 0) { + return {}; + } thread_local simdjson::dom::parser parser; // it's always safe to add the padding,