From 258f927a0ff02d3cfd7659418d4fb450034fe592 Mon Sep 17 00:00:00 2001 From: Tobias Gloth Date: Thu, 15 Oct 2026 07:14:26 -0400 Subject: [PATCH] Fix: Crash by null mainframe in BackgroundSlicingProcess for CLI (#15367) * add nullptr check * use plater from app instead mainframe --------- Co-authored-by: yw4z --- src/slic3r/GUI/BackgroundSlicingProcess.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/BackgroundSlicingProcess.cpp b/src/slic3r/GUI/BackgroundSlicingProcess.cpp index 5030196348..b6f95e30c0 100644 --- a/src/slic3r/GUI/BackgroundSlicingProcess.cpp +++ b/src/slic3r/GUI/BackgroundSlicingProcess.cpp @@ -747,7 +747,9 @@ Print::ApplyStatus BackgroundSlicingProcess::apply(const Model& model, const Dyn // Orca: prevent resetting under gcode viewer mode if (invalidated != PrintBase::APPLY_STATUS_UNCHANGED) { - const auto plater = GUI::wxGetApp().mainframe->m_plater; + // Use the app’s plater accessor instead of going through mainframe, otherwise anything during startup that reaches apply() + // (loading presets, config or input files, e.g. from the CLI) therefore dereferences a null `mainframe` and crashes. + const auto plater = GUI::wxGetApp().plater(); if (plater && plater->only_gcode_mode()) { invalidated = PrintBase::APPLY_STATUS_UNCHANGED; }