From de9ffbc6251a6b05bbf37016d2ecfdd4308be4d5 Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Mon, 25 Sep 2023 14:45:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=90=86=E6=99=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E4=B8=80=E7=B3=BB=E5=88=97=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Assistant.cpp | 2 +- src/MaaWpfGui/Main/AsstProxy.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/MaaCore/Assistant.cpp b/src/MaaCore/Assistant.cpp index 67286346c8..b6efd4cea5 100644 --- a/src/MaaCore/Assistant.cpp +++ b/src/MaaCore/Assistant.cpp @@ -423,7 +423,7 @@ void Assistant::working_proc() callback_json["finished_tasks"] = json::array(finished_tasks); const auto& sanity_report = status()->get_str(Status::FightSanityReport); - if (sanity_report) { + if (sanity_report && !sanity_report.value().empty()) { // [100, 135, "2023-09-01 09:31:53.527"] auto sanity_array = json::array(json::parse(*sanity_report).value_or(json::value(json::array()))); callback_json["sanity"] = sanity_array; diff --git a/src/MaaWpfGui/Main/AsstProxy.cs b/src/MaaWpfGui/Main/AsstProxy.cs index cb060b255a..c199d0658b 100644 --- a/src/MaaWpfGui/Main/AsstProxy.cs +++ b/src/MaaWpfGui/Main/AsstProxy.cs @@ -623,6 +623,11 @@ namespace MaaWpfGui.Main break; } + if (!sanity_report.Select(i => i.Type).SequenceEqual(new[] { JTokenType.Integer, JTokenType.Integer, JTokenType.String })) + { + break; + } + int[] sanity = sanity_report.Take(2).Select(i => (int)i).ToArray(); if (sanity[0] < 0 || sanity[1] <= 1) {