Skip to content

Commit

Permalink
Fix crash when multiple objects are printed, and the first one isn't …
Browse files Browse the repository at this point in the history
…the tallest.

#4309
#4313
  • Loading branch information
supermerill committed Jun 11, 2024
1 parent eaf2953 commit 9c996b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3019,8 +3019,10 @@ LayerResult GCode::process_layer(
const Layer *object_layer = nullptr;
const SupportLayer *support_layer = nullptr;
const SupportLayer *raft_layer = nullptr;
const size_t layer_id = layers.front().layer()->id();
/*const*/ size_t layer_id = size_t(-1);
for (const LayerToPrint &l : layers) {
if(l.layer())
layer_id = l.layer()->id();
if (l.object_layer && ! object_layer)
object_layer = l.object_layer;
if (l.support_layer) {
Expand All @@ -3031,6 +3033,7 @@ LayerResult GCode::process_layer(
}
assert(l.layer() == nullptr || layer_id == l.layer()->id());
}
assert(layer_id < layer_count());
const Layer &layer = (object_layer != nullptr) ? *object_layer : *support_layer;
LayerResult result { {}, layer.id(), false, last_layer, false};
if (layer_tools.extruders.empty())
Expand Down

0 comments on commit 9c996b6

Please sign in to comment.