mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 12:11:59 +08:00
Fix of asserts
This commit is contained in:
parent
fc27654827
commit
c70cb1ac15
@ -3924,7 +3924,7 @@ const Preset* find_preset_by_nozzle_and_options(
|
|||||||
case coStrings: opt_val = static_cast<const ConfigOptionStrings*>(preset.config.option(opt.first))->values[0]; break;
|
case coStrings: opt_val = static_cast<const ConfigOptionStrings*>(preset.config.option(opt.first))->values[0]; break;
|
||||||
case coBools: opt_val = static_cast<const ConfigOptionBools*>(preset.config.option(opt.first))->values[0] ? "1" : "0"; break;
|
case coBools: opt_val = static_cast<const ConfigOptionBools*>(preset.config.option(opt.first))->values[0] ? "1" : "0"; break;
|
||||||
default:
|
default:
|
||||||
assert(true);
|
assert(false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,14 +418,14 @@ void PresetArchiveDatabase::set_installed_printer_repositories(const std::vector
|
|||||||
|
|
||||||
if (selected_uuid.empty() && unselected_uuid.empty()) {
|
if (selected_uuid.empty() && unselected_uuid.empty()) {
|
||||||
// there is id in used_ids that is not in m_archive_repositories - BAD
|
// there is id in used_ids that is not in m_archive_repositories - BAD
|
||||||
assert(true);
|
assert(false);
|
||||||
continue;
|
continue;
|
||||||
} else if (selected_uuid.size() == 1){
|
} else if (selected_uuid.size() == 1){
|
||||||
// regular case
|
// regular case
|
||||||
m_has_installed_printer_repositories_uuid[selected_uuid.front()] = true;
|
m_has_installed_printer_repositories_uuid[selected_uuid.front()] = true;
|
||||||
} else if (selected_uuid.size() > 1) {
|
} else if (selected_uuid.size() > 1) {
|
||||||
// this should not happen, only one repo of same id should be selected (online / local conflict)
|
// this should not happen, only one repo of same id should be selected (online / local conflict)
|
||||||
assert(true);
|
assert(false);
|
||||||
// select first one to solve the conflict
|
// select first one to solve the conflict
|
||||||
m_has_installed_printer_repositories_uuid[selected_uuid.front()] = true;
|
m_has_installed_printer_repositories_uuid[selected_uuid.front()] = true;
|
||||||
// unselect the rest
|
// unselect the rest
|
||||||
@ -517,7 +517,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(true);
|
assert(false);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to read Archive Source Manifest at " << path;
|
BOOST_LOG_TRIVIAL(error) << "Failed to read Archive Source Manifest at " << path;
|
||||||
}
|
}
|
||||||
if (data.empty()) {
|
if (data.empty()) {
|
||||||
@ -544,14 +544,14 @@ void PresetArchiveDatabase::load_app_manifest_json()
|
|||||||
if(const auto used = subtree.second.get_optional<bool>("selected"); used) {
|
if(const auto used = subtree.second.get_optional<bool>("selected"); used) {
|
||||||
m_selected_repositories_uuid[uuid] = extracted && *used;
|
m_selected_repositories_uuid[uuid] = extracted && *used;
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
m_selected_repositories_uuid[uuid] = extracted;
|
m_selected_repositories_uuid[uuid] = extracted;
|
||||||
}
|
}
|
||||||
// "has_installed_printers" flag
|
// "has_installed_printers" flag
|
||||||
if (const auto used = subtree.second.get_optional<bool>("has_installed_printers"); used) {
|
if (const auto used = subtree.second.get_optional<bool>("has_installed_printers"); used) {
|
||||||
m_has_installed_printer_repositories_uuid[uuid] = extracted && *used;
|
m_has_installed_printer_repositories_uuid[uuid] = extracted && *used;
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
m_has_installed_printer_repositories_uuid[uuid] = false;
|
m_has_installed_printer_repositories_uuid[uuid] = false;
|
||||||
}
|
}
|
||||||
m_archive_repositories.emplace_back(std::make_unique<LocalArchiveRepository>(std::move(uuid), std::move(manifest), extracted));
|
m_archive_repositories.emplace_back(std::make_unique<LocalArchiveRepository>(std::move(uuid), std::move(manifest), extracted));
|
||||||
@ -562,7 +562,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
|
|||||||
ArchiveRepository::RepositoryManifest manifest;
|
ArchiveRepository::RepositoryManifest manifest;
|
||||||
std::string uuid = get_next_uuid();
|
std::string uuid = get_next_uuid();
|
||||||
if (!extract_repository_header(subtree.second, manifest)) {
|
if (!extract_repository_header(subtree.second, manifest)) {
|
||||||
assert(true);
|
assert(false);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to read one of source headers.";
|
BOOST_LOG_TRIVIAL(error) << "Failed to read one of source headers.";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -570,14 +570,14 @@ void PresetArchiveDatabase::load_app_manifest_json()
|
|||||||
if (const auto used = subtree.second.get_optional<bool>("selected"); used) {
|
if (const auto used = subtree.second.get_optional<bool>("selected"); used) {
|
||||||
m_selected_repositories_uuid[uuid] = *used;
|
m_selected_repositories_uuid[uuid] = *used;
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
m_selected_repositories_uuid[uuid] = true;
|
m_selected_repositories_uuid[uuid] = true;
|
||||||
}
|
}
|
||||||
// "has_installed_printers" flag
|
// "has_installed_printers" flag
|
||||||
if (const auto used = subtree.second.get_optional<bool>("has_installed_printers"); used) {
|
if (const auto used = subtree.second.get_optional<bool>("has_installed_printers"); used) {
|
||||||
m_has_installed_printer_repositories_uuid[uuid] = *used;
|
m_has_installed_printer_repositories_uuid[uuid] = *used;
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
m_has_installed_printer_repositories_uuid[uuid] = false;
|
m_has_installed_printer_repositories_uuid[uuid] = false;
|
||||||
}
|
}
|
||||||
m_archive_repositories.emplace_back(std::make_unique<OnlineArchiveRepository>(std::move(uuid), std::move(manifest)));
|
m_archive_repositories.emplace_back(std::make_unique<OnlineArchiveRepository>(std::move(uuid), std::move(manifest)));
|
||||||
@ -679,7 +679,7 @@ void PresetArchiveDatabase::save_app_manifest_json() const
|
|||||||
file << data;
|
file << data;
|
||||||
file.close();
|
file.close();
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to write Archive Repository Manifest to " << path;
|
BOOST_LOG_TRIVIAL(error) << "Failed to write Archive Repository Manifest to " << path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -757,7 +757,7 @@ void PresetArchiveDatabase::read_server_manifest(const std::string& json_body)
|
|||||||
for (const auto& subtree : ptree) {
|
for (const auto& subtree : ptree) {
|
||||||
ArchiveRepository::RepositoryManifest manifest;
|
ArchiveRepository::RepositoryManifest manifest;
|
||||||
if (!extract_repository_header(subtree.second, manifest)) {
|
if (!extract_repository_header(subtree.second, manifest)) {
|
||||||
assert(true);
|
assert(false);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Failed to read one of repository headers.";
|
BOOST_LOG_TRIVIAL(error) << "Failed to read one of repository headers.";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ bool UserAccount::on_connect_printers_success(const std::string& data, AppConfig
|
|||||||
if (auto pair = printer_state_table.find(*printer_state); pair != printer_state_table.end()) {
|
if (auto pair = printer_state_table.find(*printer_state); pair != printer_state_table.end()) {
|
||||||
state = pair->second;
|
state = pair->second;
|
||||||
} else {
|
} else {
|
||||||
assert(true); // On this assert, printer_state_table needs to be updated with *state_opt and correct ConnectPrinterState
|
assert(false); // On this assert, printer_state_table needs to be updated with *state_opt and correct ConnectPrinterState
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (m_printer_uuid_map.find(*printer_uuid) == m_printer_uuid_map.end()) {
|
if (m_printer_uuid_map.find(*printer_uuid) == m_printer_uuid_map.end()) {
|
||||||
|
@ -487,7 +487,7 @@ void PrinterPickWebViewDialog::on_script_message(wxWebViewEvent& evt)
|
|||||||
void PrinterPickWebViewDialog::on_connect_action_select_printer(const std::string& message_data)
|
void PrinterPickWebViewDialog::on_connect_action_select_printer(const std::string& message_data)
|
||||||
{
|
{
|
||||||
// SELECT_PRINTER request is not defined for PrinterPickWebViewDialog
|
// SELECT_PRINTER request is not defined for PrinterPickWebViewDialog
|
||||||
assert(true);
|
assert(false);
|
||||||
}
|
}
|
||||||
void PrinterPickWebViewDialog::on_connect_action_print(const std::string& message_data)
|
void PrinterPickWebViewDialog::on_connect_action_print(const std::string& message_data)
|
||||||
{
|
{
|
||||||
@ -673,17 +673,17 @@ void PrintablesConnectUploadDialog::on_script_message(wxWebViewEvent& evt)
|
|||||||
void PrintablesConnectUploadDialog::on_connect_action_select_printer(const std::string& message_data)
|
void PrintablesConnectUploadDialog::on_connect_action_select_printer(const std::string& message_data)
|
||||||
{
|
{
|
||||||
// SELECT_PRINTER request is not defined for PrintablesConnectUploadDialog
|
// SELECT_PRINTER request is not defined for PrintablesConnectUploadDialog
|
||||||
assert(true);
|
assert(false);
|
||||||
}
|
}
|
||||||
void PrintablesConnectUploadDialog::on_connect_action_print(const std::string& message_data)
|
void PrintablesConnectUploadDialog::on_connect_action_print(const std::string& message_data)
|
||||||
{
|
{
|
||||||
assert(true);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintablesConnectUploadDialog::on_connect_action_webapp_ready(const std::string& message_data)
|
void PrintablesConnectUploadDialog::on_connect_action_webapp_ready(const std::string& message_data)
|
||||||
{
|
{
|
||||||
// WEBAPP_READY request is not defined for PrintablesConnectUploadDialog
|
// WEBAPP_READY request is not defined for PrintablesConnectUploadDialog
|
||||||
assert(true);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintablesConnectUploadDialog::on_reload_event(const std::string& message_data)
|
void PrintablesConnectUploadDialog::on_reload_event(const std::string& message_data)
|
||||||
|
@ -105,7 +105,7 @@ protected:
|
|||||||
void run_script_bridge(const wxString& script) override { run_script(script); }
|
void run_script_bridge(const wxString& script) override { run_script(script); }
|
||||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||||
void on_reload_event(const std::string& message_data) override;
|
void on_reload_event(const std::string& message_data) override;
|
||||||
void on_connect_action_close_dialog(const std::string& message_data) override {assert(true);}
|
void on_connect_action_close_dialog(const std::string& message_data) override {assert(false);}
|
||||||
private:
|
private:
|
||||||
std::string& m_ret_val;
|
std::string& m_ret_val;
|
||||||
};
|
};
|
||||||
|
@ -866,7 +866,7 @@ void ConnectWebViewPanel::on_connect_action_select_printer(const std::string& me
|
|||||||
void ConnectWebViewPanel::on_connect_action_print(const std::string& message_data)
|
void ConnectWebViewPanel::on_connect_action_print(const std::string& message_data)
|
||||||
{
|
{
|
||||||
// PRINT request is not defined for ConnectWebViewPanel
|
// PRINT request is not defined for ConnectWebViewPanel
|
||||||
assert(true);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PrinterWebViewPanel::PrinterWebViewPanel(wxWindow* parent, const wxString& default_url)
|
PrinterWebViewPanel::PrinterWebViewPanel(wxWindow* parent, const wxString& default_url)
|
||||||
|
@ -141,7 +141,7 @@ protected:
|
|||||||
void on_page_will_load() override;
|
void on_page_will_load() override;
|
||||||
void on_connect_action_error(const std::string &message_data) override;
|
void on_connect_action_error(const std::string &message_data) override;
|
||||||
void on_reload_event(const std::string& message_data) override;
|
void on_reload_event(const std::string& message_data) override;
|
||||||
void on_connect_action_close_dialog(const std::string& message_data) override {assert(true);}
|
void on_connect_action_close_dialog(const std::string& message_data) override {assert(false);}
|
||||||
void on_user_token(UserAccountSuccessEvent& e);
|
void on_user_token(UserAccountSuccessEvent& e);
|
||||||
private:
|
private:
|
||||||
static wxString get_login_script(bool refresh);
|
static wxString get_login_script(bool refresh);
|
||||||
|
@ -206,7 +206,7 @@ void PresetUpdaterWrapper::cancel_worker_thread()
|
|||||||
if (m_worker_thread.joinable()) {
|
if (m_worker_thread.joinable()) {
|
||||||
if (m_ui_status) {
|
if (m_ui_status) {
|
||||||
m_ui_status->set_canceled(true);
|
m_ui_status->set_canceled(true);
|
||||||
} else assert(true);
|
} else assert(false);
|
||||||
|
|
||||||
m_worker_thread.join();
|
m_worker_thread.join();
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ PresetUpdaterUIStatus::PresetUpdaterUIStatus(PresetUpdaterUIStatus::PresetUpdate
|
|||||||
if (auto it = policy_map.find(policy); it != policy_map.end()) {
|
if (auto it = policy_map.find(policy); it != policy_map.end()) {
|
||||||
m_retry_policy = it->second;
|
m_retry_policy = it->second;
|
||||||
} else {
|
} else {
|
||||||
assert(true);
|
assert(false);
|
||||||
m_retry_policy = {0ms};
|
m_retry_policy = {0ms};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user