From 18c8204837502d3103f793e863c44c6bdc7eca93 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Thu, 2 Sep 2021 14:37:29 +0200 Subject: [PATCH] Fix of #6873: Bed texture located in a directory that user has no permission to (crashed) --- src/slic3r/GUI/3DBed.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 7b08b5f793..eaf75ba5b6 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -141,11 +141,13 @@ void Bed3D::Axes::render() const bool Bed3D::set_shape(const Pointfs& shape, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) { auto check_texture = [](const std::string& texture) { - return !texture.empty() && (boost::algorithm::iends_with(texture, ".png") || boost::algorithm::iends_with(texture, ".svg")) && boost::filesystem::exists(texture); + boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem) + return !texture.empty() && (boost::algorithm::iends_with(texture, ".png") || boost::algorithm::iends_with(texture, ".svg")) && boost::filesystem::exists(texture, ec); }; auto check_model = [](const std::string& model) { - return !model.empty() && boost::algorithm::iends_with(model, ".stl") && boost::filesystem::exists(model); + boost::system::error_code ec; + return !model.empty() && boost::algorithm::iends_with(model, ".stl") && boost::filesystem::exists(model, ec); }; EType type;