diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 75681fc548..1a8361ff3f 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1297,6 +1297,11 @@ public: default: NOT_REACHED(); } + list->clear(); + if constexpr (std::is_same_v>) { + list->reserve(length); + } + /* Load each value and push to the end of the storage. */ for (size_t i = 0; i < length; i++) { Tvar &data = list->emplace_back();