Commit 9e7931d8 authored by Julien Osman's avatar Julien Osman
Browse files

BUG: Copy the maps before iterating over them and modifying them

parent c24fe741
......@@ -477,7 +477,8 @@ void ImageMetadata::compact()
bool compactVal;
// TODO Compact the GeometryKeys when comparisons exists
// Compact NumericKeys
for (const auto& kv : this->Bands.front().NumericKeys)
auto numKeys = this->Bands.front().NumericKeys;
for (const auto& kv : numKeys)
{
compactVal = true;
auto bandIt = this->Bands.cbegin();
......@@ -502,7 +503,8 @@ void ImageMetadata::compact()
}
}
// Compact StringKeys
for (const auto& kv : this->Bands.front().StringKeys)
auto strKeys = this->Bands.front().StringKeys;
for (const auto& kv : strKeys)
{
compactVal = true;
auto bandIt = this->Bands.cbegin();
......@@ -529,7 +531,8 @@ void ImageMetadata::compact()
// TODO Compact LUT1DKeys when comparisons exists
// TODO Compact LUT2DKeys when comparisons exists
// Compact TimeKeys
for (const auto& kv : this->Bands.front().TimeKeys)
auto timeKeys = this->Bands.front().TimeKeys;
for (const auto& kv : timeKeys)
{
compactVal = true;
auto bandIt = this->Bands.cbegin();
......@@ -554,7 +557,8 @@ void ImageMetadata::compact()
}
}
// Compact ExtraKeys
for (const auto& kv : this->Bands.front().ExtraKeys)
auto extraKeys = this->Bands.front().ExtraKeys;
for (const auto& kv : extraKeys)
{
compactVal = true;
auto bandIt = this->Bands.cbegin();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment