Throw a custom exception if Print::delete_object() gets an out-of-range identifier.

This commit is contained in:
Joseph Lenox 2018-05-13 00:06:34 -05:00 committed by Joseph Lenox
parent d56ce183a4
commit d34d0ea6ea
2 changed files with 6 additions and 0 deletions

View File

@ -77,6 +77,8 @@ void
Print::delete_object(size_t idx)
{
PrintObjectPtrs::iterator i = this->objects.begin() + idx;
if (i >= this->objects.end())
throw InvalidObjectException();
// before deleting object, invalidate all of its steps in order to
// invalidate all of the dependent ones in Print

View File

@ -16,8 +16,12 @@
#include "SlicingAdaptive.hpp"
#include "LayerHeightSpline.hpp"
#include <exception>
namespace Slic3r {
class InvalidObjectException : public std::exception {};
class Print;
class PrintObject;
class ModelObject;