From 83a98d43bfa44844ad4dcf3153cbca2854c024f1 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 5 Feb 2024 12:45:52 +0100 Subject: [PATCH] Fixed crash when loading invalid 3MFs (SPE-2135) 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. --- src/libslic3r/Format/3mf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp index dd9fab6123..d2ca7b1104 100644 --- a/src/libslic3r/Format/3mf.cpp +++ b/src/libslic3r/Format/3mf.cpp @@ -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)