From 4c1c9a180c90950d198b10e29afbfcfc562fb062 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Wed, 4 Jun 2025 15:28:16 +0800 Subject: [PATCH] FIX:deal null pointer jira: github 7109 Change-Id: I1db1dd1b306a33c80b256a7b6f9460ad3d35d1db (cherry picked from commit c79311e3ee2d13dcfd733e413812c5b52f6aac9c) --- src/slic3r/GUI/Plater.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f529c18acd..42731f3d41 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4899,14 +4899,21 @@ void Plater::priv::select_view(const std::string& direction) const VendorProfile::PrinterModel *Plater::get_curr_printer_model() { - auto bundle = wxGetApp().preset_bundle; - const Preset * curr = &bundle->printers.get_selected_preset(); - const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr); - if (!pm) { - auto curr_parent = bundle->printers.get_selected_preset_parent(); - pm = PresetUtils::system_printer_model(*curr_parent); + auto bundle = wxGetApp().preset_bundle; + if (bundle) { + const Preset *curr = &bundle->printers.get_selected_preset(); + if (curr) { + const VendorProfile::PrinterModel *pm = PresetUtils::system_printer_model(*curr); + if (!pm) { + auto curr_parent = bundle->printers.get_selected_preset_parent(); + if (curr_parent) { + pm = PresetUtils::system_printer_model(*curr_parent); + } + } + return pm; + } } - return pm; + return nullptr; } wxColour Plater::get_next_color_for_filament()