From 9d96b08cf67da17f02df10b0d9a1df67c9bca9e5 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 16 Oct 2023 01:05:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=B3=E8=BF=87=20`$`=20=E5=BC=80?= =?UTF-8?q?=E5=A4=B4=E7=9A=84=E9=94=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/MaaFramework/Resource/PipelineResMgr.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/MaaFramework/Resource/PipelineResMgr.cpp b/source/MaaFramework/Resource/PipelineResMgr.cpp index 7e6903585..3b580f2d4 100644 --- a/source/MaaFramework/Resource/PipelineResMgr.cpp +++ b/source/MaaFramework/Resource/PipelineResMgr.cpp @@ -157,10 +157,22 @@ bool PipelineResMgr::parse_config(const json::value& input, TaskDataMap& output, TaskDataMap data_map; for (const auto& [key, value] : input.as_object()) { + if (key.empty()) { + LogError << "key is empty" << VAR(key); + return false; + } + if (key.starts_with('$')) { + LogInfo << "key starts with '$', skip" << VAR(key); + continue; + } if (existing_keys.contains(key)) { LogError << "key already exists" << VAR(key); return false; } + if (!value.is_object()) { + LogError << "value is not object" << VAR(key) << VAR(value); + return false; + } TaskData task_data; const auto& default_task_data = default_value.contains(key) ? default_value.at(key) : TaskData {};