mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
When reading, don't add items to a vector before they are read. This avoids nullptrs in the list of fields, cards, etc. when exceptions are thrown
This commit is contained in:
@@ -217,9 +217,10 @@ template <typename T>
|
||||
void Reader::handle(const Char* name, vector<T>& vector) {
|
||||
String vectorKey = singular_form(name);
|
||||
while (enterBlock(vectorKey.c_str())) {
|
||||
vector.resize(vector.size() + 1);
|
||||
handle_greedy(vector.back());
|
||||
update_index(vector.back(), vector.size() - 1); // update index for IndexMap
|
||||
T item;
|
||||
handle_greedy(item);
|
||||
update_index(item, vector.size()); // update index for IndexMap
|
||||
vector.emplace_back(std::move(item));
|
||||
exitBlock();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user