From e714e42618d6e3db0f6dc2d7ef5200cc5399ba31 Mon Sep 17 00:00:00 2001 From: smellthemoon <64083300+smellthemoon@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:36:21 +0800 Subject: [PATCH] fix: parse fail in empty json(#37294) (#37295) pr: #37294 issue: #37200 Signed-off-by: lixinguo Co-authored-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,