Skip to content

Commit 3afd8e9

Browse files
committed
修正插件版本号中包含非数字字符的情况下,插件检查更新时程序会崩溃的问题
1 parent 641bff4 commit 3afd8e9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

TrafficMonitor/PluginUpdateHelper.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ static void VersionFromString(const std::string& version_str, std::vector<int>&
1313
//转换为整数保存
1414
for (const auto& str : vec_version)
1515
{
16-
versions.push_back(std::stoi(str));
16+
//去掉除数字以外的字符
17+
std::string str_ver;
18+
for (auto ch : str)
19+
{
20+
if (ch >= '0' && ch <= '9')
21+
str_ver.push_back(ch);
22+
}
23+
24+
versions.push_back(atoi(str_ver.c_str()));
1725
}
1826
}
1927

0 commit comments

Comments
 (0)