Sat, 03 Mar 2018 17:59:32 +0200
removed another LDObject::model() use
src/model.h | file | annotate | diff | comparison | revisions |
--- a/src/model.h Sat Mar 03 17:57:35 2018 +0200 +++ b/src/model.h Sat Mar 03 17:59:32 2018 +0200 @@ -179,15 +179,18 @@ template<typename T, typename... Args> T* Model::emplaceReplacement(LDObject* object, Args&& ...args) { - if (object->model() == this) + QModelIndex position = this->indexOf(object); + + if (position.isValid()) { - QModelIndex position = indexOf(object); T* replacement = constructObject<T>(args...); setObjectAt(position.row(), replacement); return replacement; } else + { return nullptr; + } } /*