Fix of #6873: Bed texture located in a directory that user has no permission to (crashed)
This commit is contained in:
parent
0efa0fc512
commit
18c8204837
@ -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)
|
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) {
|
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) {
|
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;
|
EType type;
|
||||||
|
Loading…
Reference in New Issue
Block a user