Fixed issue #420. Crash, not able to to open Standard measurements tables.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-12-19 10:09:03 +02:00
parent 103eb7b438
commit 2fdd441a1c

View File

@ -1192,8 +1192,16 @@ void MainWindow::LoadStandard()
if (not mPath.isEmpty()) if (not mPath.isEmpty())
{ {
const int hIndex = gradationHeights->currentIndex(); int hIndex = -1;
const int sIndex = gradationSizes->currentIndex(); if (not gradationHeights.isNull())
{
hIndex = gradationHeights->currentIndex();
}
int sIndex = -1;
if (not gradationSizes.isNull())
{
sIndex = gradationSizes->currentIndex();
}
if(LoadMeasurements(mPath)) if(LoadMeasurements(mPath))
{ {
@ -1213,12 +1221,12 @@ void MainWindow::LoadStandard()
if (qApp->patternType() == MeasurementsType::Standard) if (qApp->patternType() == MeasurementsType::Standard)
{ {
if (hIndex != -1) if (hIndex != -1 && not gradationSizes.isNull())
{ {
gradationHeights->setCurrentIndex(hIndex); gradationHeights->setCurrentIndex(hIndex);
} }
if (sIndex != -1) if (sIndex != -1 && not gradationSizes.isNull())
{ {
gradationSizes->setCurrentIndex(sIndex); gradationSizes->setCurrentIndex(sIndex);
} }