From 51cb2fbf972d5965b3f95e3037c6185b43f7131a Mon Sep 17 00:00:00 2001 From: smellthemoon <64083300+smellthemoon@users.noreply.github.com> Date: Sun, 3 Nov 2024 19:00:21 +0800 Subject: [PATCH] fix: parse fail in empty json (#37294) #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,