From 04799bb0cd7d07ecc2e329e2f435da1a81675c7a Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Mon, 2 Oct 2023 17:20:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E9=98=88=E5=80=BC=E8=A7=A3=E6=9E=90=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Config/TaskData.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/MaaCore/Config/TaskData.cpp b/src/MaaCore/Config/TaskData.cpp index 685f4463dd..6261ce0240 100644 --- a/src/MaaCore/Config/TaskData.cpp +++ b/src/MaaCore/Config/TaskData.cpp @@ -765,7 +765,7 @@ asst::TaskData::taskptr_t asst::TaskData::generate_match_task_info(std::string_v // 其余若留空则继承模板任务 - auto threshold_opt = task_json.find("threshold"); + auto threshold_opt = task_json.find("templThreshold"); if (!threshold_opt) { match_task_info_ptr->templ_thresholds = default_ptr->templ_thresholds; match_task_info_ptr->templ_thresholds.resize(match_task_info_ptr->templ_names.size(), @@ -779,12 +779,17 @@ asst::TaskData::taskptr_t asst::TaskData::generate_match_task_info(std::string_v std::back_inserter(match_task_info_ptr->templ_thresholds)); } else { - Log.error("Invalid threshold type in task", name); + Log.error("Invalid templThreshold type in task", name); return nullptr; } if (match_task_info_ptr->templ_names.size() != match_task_info_ptr->templ_thresholds.size()) { - Log.error("Template count and threshold count not match in task", name); + Log.error("Template count and templThreshold count not match in task", name); + return nullptr; + } + + if (match_task_info_ptr->templ_names.size() == 0 || match_task_info_ptr->templ_thresholds.size() == 0) { + Log.error("Template or templThreshold is empty in task", name); return nullptr; }