diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2021-06-01 12:12:55 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2021-06-01 12:12:55 +0300 |
commit | 7681eb849645799dc3952b0425a7300c9b71810e (patch) | |
tree | 8c468290bfab9945700210c699cd28ee2bad52f0 /src | |
parent | 206bef76239bd4ce2051d36ac73f34de7b83b770 (diff) |
PrintRegion refactoring: Fixed a crash when an object is moved from outside
the print bed inside and it becomes printable.
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/PrintApply.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libslic3r/PrintApply.cpp b/src/libslic3r/PrintApply.cpp index 88023fee1..fe90abbd7 100644 --- a/src/libslic3r/PrintApply.cpp +++ b/src/libslic3r/PrintApply.cpp @@ -1068,10 +1068,13 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_ bool layer_height_ranges_differ = ! layer_height_ranges_equal(model_object.layer_config_ranges, model_object_new.layer_config_ranges, model_object_new.layer_height_profile.empty()); bool model_origin_translation_differ = model_object.origin_translation != model_object_new.origin_translation; auto print_objects_range = print_object_status_db.get_range(model_object); - assert(print_objects_range.begin() != print_objects_range.end()); + // The list actually can be empty if all instances are out of the print bed. + //assert(print_objects_range.begin() != print_objects_range.end()); // All PrintObjects in print_objects_range shall point to the same prints_objects_regions - model_object_status.print_object_regions = print_objects_range.begin()->print_object->m_shared_regions; - model_object_status.print_object_regions->ref_cnt_inc(); + if (print_objects_range.begin() != print_objects_range.end()) { + model_object_status.print_object_regions = print_objects_range.begin()->print_object->m_shared_regions; + model_object_status.print_object_regions->ref_cnt_inc(); + } if (solid_or_modifier_differ || model_origin_translation_differ || layer_height_ranges_differ || ! model_object.layer_height_profile.timestamp_matches(model_object_new.layer_height_profile)) { // The very first step (the slicing step) is invalidated. One may freely remove all associated PrintObjects. |