diff --git a/src/model/Layer.cpp b/src/model/Layer.cpp index 47485561..19b5422c 100644 --- a/src/model/Layer.cpp +++ b/src/model/Layer.cpp @@ -82,6 +82,9 @@ void Layer::insertElement(Element* e, int pos) } } + if(pos == -1) pos=0; //otherwise it segfaults on the next step trying + //to access a negative index on the elements array + this->elements.insert(this->elements.begin() + pos, e); }