mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
FIX: CLI: fix the size related issue in set_with_restore_2
jira: no-jira Change-Id: I5b9b5dd3ae2eac63e9f494fd7b7ab5d4d38dbac7 (cherry picked from commit 030ebd1a3515a7d3dbdf3c6cfb77ff0b6b764f2e)
This commit is contained in:
@@ -514,11 +514,17 @@ public:
|
|||||||
//backup original ones
|
//backup original ones
|
||||||
std::vector<T> backup_values = this->values;
|
std::vector<T> backup_values = this->values;
|
||||||
|
|
||||||
if (this->values.size() < (start+len))
|
if (this->values.size() < start) {
|
||||||
throw ConfigurationError("ConfigOptionVector::set_with_restore_2(): invalid size found");
|
throw ConfigurationError("ConfigOptionVector::set_with_restore_2(): invalid size found");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this->values.size() < start + len)
|
||||||
|
len = this->values.size() - start;
|
||||||
|
|
||||||
//erase the original ones
|
//erase the original ones
|
||||||
this->values.erase(this->values.begin() + start, this->values.begin() + start + len);
|
if (len > 0)
|
||||||
|
this->values.erase(this->values.begin() + start, this->values.begin() + start + len);
|
||||||
|
}
|
||||||
|
|
||||||
// Assign the new value from the rhs vector.
|
// Assign the new value from the rhs vector.
|
||||||
auto other = static_cast<const ConfigOptionVector<T>*>(rhs);
|
auto other = static_cast<const ConfigOptionVector<T>*>(rhs);
|
||||||
|
|||||||
Reference in New Issue
Block a user