Skip to content

Commit dfb53c0

Browse files
authored
Merge pull request #956 from marktsuchida/fix-get-cur-px-size-cfg-nullopt
Fix crash in getCurrentPixelSizeConfig
2 parents 8399a00 + d86b777 commit dfb53c0

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

MMCore.cpp

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5873,25 +5873,28 @@ std::string CMMCore::getCurrentPixelSizeConfig(bool cached) MMCORE_LEGACY_THROW(
58735873
const auto propName = cs.getPropertyName();
58745874
if (!curState.isPropertyIncluded(deviceLabel.c_str(), propName.c_str()))
58755875
{
5876-
try
5876+
std::string value;
5877+
if (!cached)
58775878
{
5878-
std::string value;
5879-
if (!cached)
5879+
try
58805880
{
58815881
value = getProperty(deviceLabel.c_str(), propName.c_str());
58825882
}
5883-
else
5883+
catch (CMMError& err)
58845884
{
5885-
value = stateCache_->getSetting(deviceLabel.c_str(), propName.c_str())->getPropertyValue();
5885+
logError(deviceLabel.c_str(), err.getMsg().c_str());
5886+
continue;
58865887
}
5887-
PropertySetting ss(deviceLabel.c_str(), propName.c_str(), value.c_str()); // state setting
5888-
curState.addSetting(ss);
58895888
}
5890-
catch (CMMError& err)
5889+
else
58915890
{
5892-
// just log error
5893-
logError(deviceLabel.c_str(), err.getMsg().c_str());
5891+
auto s = stateCache_->getSetting(deviceLabel.c_str(), propName.c_str());
5892+
if (!s)
5893+
continue;
5894+
value = s->getPropertyValue();
58945895
}
5896+
PropertySetting ss(deviceLabel.c_str(), propName.c_str(), value.c_str()); // state setting
5897+
curState.addSetting(ss);
58955898
}
58965899
}
58975900
}

0 commit comments

Comments
 (0)