Skip to content

Commit

Permalink
Fixed crash when loading invalid 3MFs (SPE-2135)
Browse files Browse the repository at this point in the history
The crash was introduced in 040a846, which completely threw away handling of the return value
of the importer.load_model_from_file function and replaced it with weaker condition. The purpose
of that change was to solve #8401 (missing error message when loading different invalid 3MF).

This commit reverts that change (and reintroduces #8401). Handling of 3MF loading errors
should be inside the importer.load_model_from_file function, where the check should be
added later.
  • Loading branch information
lukasmatena committed Feb 8, 2024
1 parent 054e932 commit 83a98d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libslic3r/Format/3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3574,11 +3574,11 @@ bool load_3mf(const char* path, DynamicPrintConfig& config, ConfigSubstitutionCo
// All import should use "C" locales for number formatting.
CNumericLocalesSetter locales_setter;
_3MF_Importer importer;
importer.load_model_from_file(path, *model, config, config_substitutions, check_version);
bool res = importer.load_model_from_file(path, *model, config, config_substitutions, check_version);
importer.log_errors();
handle_legacy_project_loaded(importer.version(), config, importer.prusaslicer_generator_version());

return !model->objects.empty() || !config.empty();
return res;
}

bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data, bool zip64)
Expand Down

0 comments on commit 83a98d4

Please sign in to comment.