ENH: add nullptr protection
Change-Id: I5d853ecebf9007a3d62bc2153b7bd62ff8dc2b4b
This commit is contained in:
parent
60b8597557
commit
1dfcbf6093
|
@ -874,20 +874,25 @@ void CalibrationPresetPage::on_recommend_input_value()
|
||||||
else if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_stage_panel) {
|
else if (m_cali_mode == CalibMode::Calib_Flow_Rate && m_cali_stage_panel) {
|
||||||
Preset *selected_filament_preset = selected_filaments.begin()->second;
|
Preset *selected_filament_preset = selected_filaments.begin()->second;
|
||||||
if (selected_filament_preset) {
|
if (selected_filament_preset) {
|
||||||
float flow_ratio = selected_filament_preset->config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
const ConfigOptionFloats* flow_ratio_opt = selected_filament_preset->config.option<ConfigOptionFloats>("filament_flow_ratio");
|
||||||
m_cali_stage_panel->set_flow_ratio_value(flow_ratio);
|
if (flow_ratio_opt) {
|
||||||
|
m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
|
||||||
Preset* selected_filament_preset = selected_filaments.begin()->second;
|
Preset* selected_filament_preset = selected_filaments.begin()->second;
|
||||||
if (selected_filament_preset) {
|
if (selected_filament_preset) {
|
||||||
double max_volumetric_speed = selected_filament_preset->config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0);
|
|
||||||
if (m_custom_range_panel) {
|
if (m_custom_range_panel) {
|
||||||
wxArrayString values;
|
const ConfigOptionFloats* speed_opt = selected_filament_preset->config.option<ConfigOptionFloats>("filament_max_volumetric_speed");
|
||||||
values.push_back(wxString::Format("%.2f", max_volumetric_speed - 5));
|
if (speed_opt) {
|
||||||
values.push_back(wxString::Format("%.2f", max_volumetric_speed + 5));
|
double max_volumetric_speed = speed_opt->get_at(0);
|
||||||
values.push_back(wxString::Format("%.2f", 0.5f));
|
wxArrayString values;
|
||||||
m_custom_range_panel->set_values(values);
|
values.push_back(wxString::Format("%.2f", max_volumetric_speed - 5));
|
||||||
|
values.push_back(wxString::Format("%.2f", max_volumetric_speed + 5));
|
||||||
|
values.push_back(wxString::Format("%.2f", 0.5f));
|
||||||
|
m_custom_range_panel->set_values(values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1592,8 +1597,10 @@ void CalibrationPresetPage::get_cali_stage(CaliPresetStage& stage, float& value)
|
||||||
|
|
||||||
if (stage != CaliPresetStage::CALI_MANUAL_STAGE_2) {
|
if (stage != CaliPresetStage::CALI_MANUAL_STAGE_2) {
|
||||||
std::map<int, Preset*> selected_filaments = get_selected_filaments();
|
std::map<int, Preset*> selected_filaments = get_selected_filaments();
|
||||||
Preset* preset = selected_filaments.begin()->second;
|
const ConfigOptionFloats* flow_ratio_opt = selected_filaments.begin()->second->config.option<ConfigOptionFloats>("filament_flow_ratio");
|
||||||
value = preset->config.option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
if (flow_ratio_opt) {
|
||||||
|
m_cali_stage_panel->set_flow_ratio_value(flow_ratio_opt->get_at(0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue