Fix for "front() called on empty vector" Errors on debug builds.
Now using the C++11 vector.data() to fetch the proper pointer instead of $vector.front() - Which fails on empty vectors because of the standard compiler setting _ITERATOR_DEBUG_LEVEL=2 when debugging
This commit is contained in:
@@ -824,7 +824,7 @@ Design::Design(SaveFile& file) : initialized(true), data(nullptr), clientData(nu
|
||||
|
||||
unsigned hexesCount = file;
|
||||
hexes.resize(hexesCount);
|
||||
file.read(&hexes.front(), sizeof(vec2u) * hexesCount);
|
||||
file.read(hexes.data(), sizeof(vec2u) * hexesCount);
|
||||
|
||||
cropMin = vec2u(grid.width, grid.height);
|
||||
cropMax = vec2u(0, 0);
|
||||
@@ -948,7 +948,7 @@ void Design::save(SaveFile& file) const {
|
||||
file.write(hexStatusIndex.data, sizeof(int) * hexStatusIndex.width * hexStatusIndex.height);
|
||||
|
||||
file << (unsigned)hexes.size();
|
||||
file.write(&hexes.front(), sizeof(vec2u) * (unsigned)hexes.size());
|
||||
file.write(hexes.data(), sizeof(vec2u) * (unsigned)hexes.size());
|
||||
|
||||
unsigned cnt = getShipVariableCount();
|
||||
file << cnt;
|
||||
|
||||
Reference in New Issue
Block a user