Skip to content

Commit

Permalink
Fixed crashes caused by failed version checks 修复:检查更新概率崩溃 (#1903)
Browse files Browse the repository at this point in the history
修复:检查更新概率崩溃

Co-authored-by: ZdDroid <[email protected]>
  • Loading branch information
ZdDroid and jiaqq02 authored Aug 24, 2023
1 parent ec8d348 commit 761417f
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4118,18 +4118,27 @@ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
Http::get(version_check_url).on_error([&](std::string body, std::string error, unsigned http_status) {
(void)body;
BOOST_LOG_TRIVIAL(error) << format("Error getting: `%1%`: HTTP %2%, %3%",
version_check_url,
"check_new_version_sf",
http_status,
error);
})
.timeout_connect(1)
.on_complete([&](std::string body, unsigned /* http_status */) {
.on_complete([&](std::string body, unsigned http_status ) {
//Http response OK
if (http_status != 200)
return;

boost::trim(body);
// SoftFever: parse github release, ported from SS

boost::property_tree::ptree root;
std::stringstream json_stream(body);
boost::property_tree::read_json(json_stream, root);
try {
std::stringstream json_stream(body);
boost::property_tree::read_json(json_stream, root);
} catch (const boost::property_tree::ptree_error &e) {
BOOST_LOG_TRIVIAL(error) << format("Error version json: `%1%`", e.what());
return;
}
bool i_am_pre = false;
//at least two number, use '.' as separator. can be followed by -Az23 for prereleased and +Az42 for metadata
std::regex matcher("[0-9]+\\.[0-9]+(\\.[0-9]+)*(-[A-Za-z0-9]+)?(\\+[A-Za-z0-9]+)?");
Expand Down

0 comments on commit 761417f

Please sign in to comment.