Fix crash when slicing batch PA pattern test (#8786)

* Fix crash when slicing batch PA pattern test (SoftFever/OrcaSlicer#8777)
This commit is contained in:
Noisyfox 2025-03-10 21:35:44 +08:00 committed by GitHub
parent ff9178b830
commit 70d7768868
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,6 +45,7 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config)
void GCodeWriter::set_extruders(std::vector<unsigned int> extruder_ids)
{
std::sort(extruder_ids.begin(), extruder_ids.end());
m_extruder = nullptr; // this points to object inside `m_extruders`, so should be cleared too
m_extruders.clear();
m_extruders.reserve(extruder_ids.size());
for (unsigned int extruder_id : extruder_ids)