Don't check the content of repetier server name

supermerill/SuperSlicer#1376
Also don't crash on identification error
This commit is contained in:
remi durand 2021-07-10 11:51:25 +02:00
parent 4d947212f4
commit d0c3cc5553
2 changed files with 34 additions and 27 deletions

View File

@ -271,6 +271,7 @@ void PhysicalPrinterDialog::update_printers()
wxArrayString printers;
Field* rs = m_optgroup->get_field("printhost_port");
try {
if (!host->get_printers(printers)) {
std::vector<std::string> slugs;
@ -297,6 +298,9 @@ void PhysicalPrinterDialog::update_printers()
}
rs->enable();
}
} catch (HostNetworkError error) {
show_error(this, error.what());
}
}
void PhysicalPrinterDialog::build_printhost_settings(ConfigOptionsGroup* m_optgroup)

View File

@ -63,10 +63,13 @@ bool Repetier::test(wxString &msg) const
pt::ptree ptree;
pt::read_json(ss, ptree);
const auto text = ptree.get_optional<std::string>("name");
res = validate_version_text(text);
if (! res) {
msg = GUI::from_u8((boost::format(_u8L("Mismatched type of print host: %s")) % (text ? *text : "Repetier")).str());
res = ptree.get_optional<std::string>("name").has_value();
if (!res)
msg = GUI::from_u8((boost::format(_u8L("Can't process the repetier return message: missing field '%s'")) % ("name")).str());
else {
res = ptree.get_optional<std::string>("printers").has_value();
if (!res)
msg = GUI::from_u8((boost::format(_u8L("Can't process the repetier return message: missing field '%s'")) % ("printers")).str());
}
}
catch (const std::exception &) {