Fix updating dimension placeholder for individual measurements.

This commit is contained in:
Roman Telezhynskyi 2020-10-22 19:24:18 +03:00
parent 7a28cbb14a
commit 909c703c46

View File

@ -2121,27 +2121,25 @@ void MainWindow::StoreIndividualMDimensions()
auto StoreDimension = [this, measurements](IMD type) auto StoreDimension = [this, measurements](IMD type)
{ {
const QString name = m->MeasurementForDimension(type); const QString name = m->MeasurementForDimension(type);
if (not name.isEmpty() && measurements.contains(name)) const bool valid = not name.isEmpty() && measurements.contains(name);
{
switch(type) switch(type)
{ {
case IMD::X: case IMD::X:
qApp->SetDimensionHeight(*measurements.value(name)->GetValue()); qApp->SetDimensionHeight(valid ? *measurements.value(name)->GetValue() : 0);
break; break;
case IMD::Y: case IMD::Y:
qApp->SetDimensionSize(*measurements.value(name)->GetValue()); qApp->SetDimensionSize(valid ? *measurements.value(name)->GetValue() : 0);
break; break;
case IMD::W: case IMD::W:
qApp->SetDimensionHip(*measurements.value(name)->GetValue()); qApp->SetDimensionHip(valid ? *measurements.value(name)->GetValue() : 0);
break; break;
case IMD::Z: case IMD::Z:
qApp->SetDimensionWaist(*measurements.value(name)->GetValue()); qApp->SetDimensionWaist(valid ? *measurements.value(name)->GetValue() : 0);
break; break;
case IMD::N: case IMD::N:
default: default:
break; break;
} }
}
}; };
StoreDimension(IMD::X); StoreDimension(IMD::X);