Print::validate() - check for empty print has been moved at the beginning of the function

This prevents a crash when the print is empty and the wipe tower enabled - validation of the wipe tower attempted to access extruders().front(), which was empty.
No other checks need to be done with the empty print anyway.
This commit is contained in:
Lukas Matena 2019-10-01 12:48:58 +02:00
parent 93a157e26c
commit 38d8854a48

View file

@ -1114,6 +1114,9 @@ std::string Print::validate() const
if (m_objects.empty())
return L("All objects are outside of the print volume.");
if (extruders().empty())
return L("The supplied settings will cause an empty print.");
if (m_config.complete_objects) {
// Check horizontal clearance.
{
@ -1271,10 +1274,7 @@ std::string Print::validate() const
}
{
// find the smallest nozzle diameter
std::vector<unsigned int> extruders = this->extruders();
if (extruders.empty())
return L("The supplied settings will cause an empty print.");
// Find the smallest used nozzle diameter and the number of unique nozzle diameters.
double min_nozzle_diameter = std::numeric_limits<double>::max();