Core: Make sure that PropertyMaterialList cannot become empty

The PropertyMaterialList is supposed to guarantee that it always has at least one element
This commit is contained in:
wmayer
2024-06-12 12:08:11 +02:00
committed by Chris Hennes
parent 30f7f26889
commit 6623b60528
2 changed files with 13 additions and 0 deletions

View File

@@ -2651,6 +2651,18 @@ PropertyMaterialList::~PropertyMaterialList() = default;
//**************************************************************************
// Base class implementer
void PropertyMaterialList::setValues(const std::vector<App::Material>& newValues)
{
if (!newValues.empty()) {
PropertyListsT<Material>::setValues(newValues);
}
else {
aboutToSetValue();
setSize(1);
hasSetValue();
}
}
PyObject* PropertyMaterialList::getPyObject()
{
Py::Tuple tuple(getSize());