FIX:deal null pointer

jira: github 7109
Change-Id: I1db1dd1b306a33c80b256a7b6f9460ad3d35d1db
(cherry picked from commit c79311e3ee2d13dcfd733e413812c5b52f6aac9c)
This commit is contained in:
zhou.xu
2025-06-04 15:28:16 +08:00
committed by Noisyfox
parent c569be0067
commit 4c1c9a180c

View File

@@ -4900,13 +4900,20 @@ void Plater::priv::select_view(const std::string& direction)
const VendorProfile::PrinterModel *Plater::get_curr_printer_model() const VendorProfile::PrinterModel *Plater::get_curr_printer_model()
{ {
auto bundle = wxGetApp().preset_bundle; auto bundle = wxGetApp().preset_bundle;
const Preset * curr = &bundle->printers.get_selected_preset(); if (bundle) {
const Preset *curr = &bundle->printers.get_selected_preset();
if (curr) {
const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr); const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr);
if (!pm) { if (!pm) {
auto curr_parent = bundle->printers.get_selected_preset_parent(); auto curr_parent = bundle->printers.get_selected_preset_parent();
if (curr_parent) {
pm = PresetUtils::system_printer_model(*curr_parent); pm = PresetUtils::system_printer_model(*curr_parent);
} }
}
return pm; return pm;
}
}
return nullptr;
} }
wxColour Plater::get_next_color_for_filament() wxColour Plater::get_next_color_for_filament()