mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix: 修复可能存在的下标越界以及识别结果分块情况
This commit is contained in:
@@ -48,13 +48,14 @@ void asst::SanityBeforeStagePlugin::get_sanity()
|
||||
Log.info("__FUNCTION__", "Current Sanity analyze failed");
|
||||
return;
|
||||
}
|
||||
auto text = analyzer.get_result().front().text;
|
||||
auto result = analyzer.get_result();
|
||||
auto text = std::string("");
|
||||
for (auto it = result.begin(); it != result.end(); it++) {
|
||||
text = text + it->text;
|
||||
}
|
||||
|
||||
Log.info("__FUNCTION__", "Current Sanity:" + text);
|
||||
if (!text.find('/')) {
|
||||
if (text.ends_with(' ')) {
|
||||
text = text.substr(0, text.find_last_not_of(' ') + 1);
|
||||
}
|
||||
if (!text.find('/') && text.length() > 3) {
|
||||
if (text[text.length() - 3] == '1' && text[text.length() - 2] <= '3') {
|
||||
text = text.substr(0, text.length() - 3) + '/' + text.substr(text.length() - 3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user