mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-04 03:00:37 +08:00
Fix undefined behaviour in maybe change instance
This commit is contained in:
parent
8119bb2925
commit
08fa362abd
@ -138,7 +138,10 @@ std::string LabelObjects::maybe_stop_instance() {
|
||||
|
||||
std::string LabelObjects::maybe_change_instance() {
|
||||
if (last_operation_instance != current_instance) {
|
||||
return this->maybe_stop_instance() + this->maybe_start_instance();
|
||||
const std::string stop_instance_gcode{this->maybe_stop_instance()};
|
||||
// Be carefull with refactoring: this->maybe_stop_instance() + this->maybe_start_instance()
|
||||
// may not be evaluated in order. The order is indeed undefined!
|
||||
return stop_instance_gcode + this->maybe_start_instance();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user